Merge pull request #74 from Yoast/dependabot/github_actions/ramsey/co… #205
This file contains 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: Test | |
on: | |
# Run on pushes to `main` and `develop` and on all pull requests. | |
push: | |
branches: | |
- main | |
- develop | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
jobs: | |
#### TEST STAGE #### | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.4'] | |
coverage: [false] | |
# Run code coverage only on high/low PHP. | |
include: | |
- php: 5.6 | |
coverage: true | |
- php: 8.3 | |
coverage: true | |
continue-on-error: ${{ matrix.php == '8.4' }} | |
name: "Tests: PHP ${{ matrix.php }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: error_reporting=E_ALL, display_errors=On | |
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }} | |
# YoastCS 3.0 has a PHP 7.2 minimum which conflicts with the requirements of this package. | |
- name: 'Composer: remove YoastCS' | |
run: composer remove --dev yoast/yoastcs --no-update --no-interaction | |
# Install dependencies and handle caching in one go. | |
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer | |
- name: Install Composer dependencies - normal | |
if: matrix.php != '8.4' | |
uses: "ramsey/composer-install@v3" | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Install Composer dependencies - ignore PHP restrictions | |
if: matrix.php == '8.4' | |
uses: "ramsey/composer-install@v3" | |
with: | |
composer-options: --ignore-platform-req=php+ | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Lint PHP files against parse errors | |
run: composer lint | |
- name: Run the unit tests | |
if: ${{ matrix.coverage == false }} | |
run: composer test | |
- name: Run the unit tests with code coverage | |
if: ${{ matrix.coverage == true }} | |
run: composer coverage | |
- name: Upload coverage results to Coveralls | |
if: ${{ success() && matrix.coverage == true }} | |
uses: coverallsapp/github-action@v2 | |
with: | |
format: clover | |
file: build/logs/clover.xml | |
flag-name: php-${{ matrix.php }} | |
parallel: true | |
coveralls-finish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true |