name: Tests
on: [push, pull_request]

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 10
      matrix:
        php: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']

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

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

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

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

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

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

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

      - name: Run tests
        env:
          SYMFONY_DEPRECATIONS_HELPER: "max[self]=0"
        run: ./vendor/bin/simple-phpunit
