name: Tests
on: [push, pull_request]

jobs:
  build:
    name: PHPUnit
    runs-on: ubuntu-22.04
    strategy:
      max-parallel: 10
      matrix:
        php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']

    steps:
      - name: Set up PHP
        uses: shivammathur/setup-php@2.9.0
        with:
          php-version: ${{ matrix.php }}
          coverage: none

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Download dependencies
        env:
          PHP_VERSION: ${{ matrix.php }}
        run: composer update

      - name: Run tests
        run: ./vendor/bin/phpunit

  lowest:
    name: Lowest deps
    runs-on: ubuntu-latest
    steps:
      - name: Set up PHP
        uses: shivammathur/setup-php@2.1.0
        with:
          php-version: 7.4
          coverage: none

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Download dependencies
        run: composer update --no-interaction --prefer-dist --prefer-stable --prefer-lowest

      - name: Run tests
        run: ./vendor/bin/phpunit
