diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index aabd94f..a8da1f5 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,4 +1,4 @@ -name: PHP Composer +name: "CI Tests" on: push: @@ -9,42 +9,54 @@ on: permissions: contents: read +env: + fail-fast: true + PHPUNIT_FLAGS: "-v" + SYMFONY_DEPRECATIONS_HELPER: weak + jobs: phpunit: - name: PHPUnit runs-on: ubuntu-latest - + name: PHP v${{ matrix.php }} with Symfony v${{ matrix.symfony }}} strategy: matrix: - php-version: - - "7.4" - - "8.0" - - "8.1" - - "8.2" - - "8.3" - dependencies: - - "highest" include: - - php-version: "7.4" - dependencies: "lowest" + - { php: "7.4", symfony: "5.4.*", composer-flags: '--prefer-stable' } + - { php: "8.1", symfony: "6.4.*", composer-flags: '--prefer-stable' } + - { php: "8.2", symfony: "7.0.*", composer-flags: '--prefer-stable' } + - { php: "8.3", symfony: "7.*", composer-flags: '--prefer-stable' } steps: - - uses: actions/checkout@v3 - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v3 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - - name: Run PHPUnit - run: vendor/bin/phpunit --coverage-clover=coverage.xml + - uses: actions/checkout@v2 + - name: "Installing php" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl,mbstring,xdebug + ini-values: date.timezone="Europe/Prague" + coverage: xdebug + tools: "composer:v2,flex" + + - name: Show PHP version + run: php -v && composer -V + + - name: Download Composer cache dependencies from cache + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ matrix.os }}-composer- + + - name: Install dependencies + run: | + perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json + composer update ${{ matrix.composer-flags }} --prefer-dist + env: + SYMFONY_REQUIRE: "${{ matrix.symfony }}" + + - name: Run PHPUnit + run: vendor/bin/phpunit --coverage-clover=coverage.xml