name: 'PHPUnit Runner'
run-name: Run PHPUnit tests
on: [push]
jobs:
  matrix-testing:
    strategy:
      matrix:
        php: ["7.3", "7.4", "8.0", "8.1"]
        guzzle: ["5", "6", "7", "7-php8"]
        exclude:
          - {php: "7.3", guzzle: "5"}
          - {php: "7.3", guzzle: "7-php8"}
          - {php: "7.4", guzzle: "5"}
          - {php: "7.4", guzzle: "7-php8"}
          - {php: "8.0", guzzle: "5"}
          - {php: "8.1", guzzle: "5"}
    runs-on: ubuntu-latest
    container:
      image: kamermans/composer:php${{ matrix.php }}
    steps:
      - uses: actions/checkout@v3
      - name: Cache composer dependencies
        id: cache-composer
        uses: actions/cache@v3
        with:
          path: guzzle_environments/${{ matrix.guzzle }}
          key: ${{ runner.os }}-build-php${{ matrix.php }}-guzzle${{ matrix.guzzle }}-composer-${{ hashFiles('guzzle_environments/**/composer.json') }}
      - if: ${{ steps.cache-composer.outputs.cache-hit != 'true' }}
        name: Composer install
        working-directory: guzzle_environments/${{ matrix.guzzle }}
        run: composer install
      - name: PHPUnit
        working-directory: guzzle_environments/${{ matrix.guzzle }}
        run: vendor/bin/phpunit -vvvv
