php-unit-tests.yml // move PHP 8.4 to separate step. #250
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHP unit tests | |
| on: | |
| push: | |
| paths: | |
| - '**workflows/php-unit-tests.yml' | |
| - '**.php' | |
| - '**phpunit.xml.dist' | |
| - '**composer.json' | |
| pull_request: | |
| paths: | |
| - '**workflows/php-unit-tests.yml' | |
| - '**.php' | |
| - '**phpunit.xml.dist' | |
| - '**composer.json' | |
| workflow_dispatch: | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| tests-unit-php: | |
| runs-on: ubuntu-latest | |
| if: ${{ (github.event_name == 'workflow_dispatch') || (!contains(github.event.head_commit.message, 'skip tests')) }} | |
| env: | |
| USE_COVERAGE: 'no' | |
| strategy: | |
| matrix: | |
| php: [ '7.4', '8.0', '8.1', '8.2', '8.3'] | |
| container-version: [ '^1.1.0', '^2' ] | |
| dependency-versions: [ 'lowest', 'highest' ] | |
| include: | |
| - php: '7.4' | |
| composer: '--ignore-platform-req=php' | |
| - php: '8.0' | |
| composer: '--ignore-platform-req=php' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use coverage? | |
| if: ${{ (matrix.php == '8.2') && (matrix.dependency-versions == 'highest') && (matrix.container-version == '^2') }} | |
| run: echo "USE_COVERAGE=yes" >> $GITHUB_ENV | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | |
| coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }} | |
| - name: Setup dependencies for PSR-11 target version | |
| run: | | |
| composer remove syde/phpcs --dev --no-update | |
| composer require "psr/container:${{ matrix.container-version }}" --no-update | |
| composer config --no-plugins allow-plugins.roots/wordpress-core-installer false | |
| - name: Install Composer dependencies | |
| uses: ramsey/composer-install@v3 | |
| with: | |
| dependency-versions: ${{ matrix.dependency-versions }} | |
| composer-options: ${{ matrix.composer || '' }} | |
| - name: Run unit tests | |
| run: ./vendor/bin/phpunit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-clover coverage.xml') || '--no-coverage' }} | |
| - name: Update coverage | |
| if: ${{ env.USE_COVERAGE == 'yes' }} | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| verbose: true | |
| test-phpunit-84: | |
| uses: inpsyde/reusable-workflows/.github/workflows/tests-unit-php.yml@main | |
| with: | |
| PHP_VERSION: "8.4" |