name: Acceptance

on: [push, pull_request]

jobs:
  test-7-4:
    runs-on: ubuntu-latest
    name: Test PHP 7.4
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Set up PHP 7.4
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'
    - name: Composer
      run: make install
    - name: Test
      run: make test

  test-8-0:
    runs-on: ubuntu-latest
    name: Test PHP 8.0
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Set up PHP 8.0
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
    - name: Composer
      run: make install
    - name: Test
      run: make test

  test-8-1:
    runs-on: ubuntu-latest
    name: Test PHP 8.1
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Set up PHP 8.1
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
    - name: Composer
      run: make install
    - name: Test
      run: make test

  test-8-2:
    runs-on: ubuntu-latest
    name: Test PHP 8.2
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Set up PHP 8.2
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
    - name: Composer
      run: make install
    - name: Test
      run: make test

  cs-check:
    runs-on: ubuntu-latest
    name: Code standard
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Set up PHP 8.0
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
    - name: Composer
      run: make install
    - name: Code standard
      run: make cs-check

  coverage:
    runs-on: ubuntu-latest
    name: Code coverage
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Set up PHP 8.0
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.0'
        extensions: xdebug
    - name: Composer
      run: make install
    - name: Code coverage
      env:
        COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: make coverage
