name: Tests

on:
  push:
  pull_request:

jobs:
  unit-tests:
    name: "Unit tests"
    runs-on: ubuntu-latest

    strategy:
      matrix:
        php-version: ['7.3', '7.4', '8.0', '8.1']
        include:
          - { php-version: '7.2', dependencies: '--prefer-lowest' }

    steps:
      - uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-version }}
          coverage: xdebug

      - name: Install PHP dependencies
        run: composer update --no-interaction ${{ matrix.dependencies }}

      - name: Run tests
        run: vendor/bin/phpunit --coverage-text
