Merge pull request #212 from Yoast/dependabot/github_actions/1.x/Davi… #701
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: Lint | |
on: | |
# Run on all pushes and on all pull requests. | |
push: | |
pull_request: | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
# Cancels all previous workflow runs for the same branch that have not yet completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
#### PHP Code Linting #### | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', 'nightly'] | |
continue-on-error: ${{ matrix.php == 'nightly' }} | |
name: "Lint: 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: zend.assertions=1, error_reporting=-1, display_errors=On | |
coverage: 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 | |
- name: 'Composer: remove PHPUnit (not needed for lint)' | |
run: composer remove phpunit/phpunit --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 != 'nightly' | |
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 == 'nightly' | |
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 - PHP < 7.0" | |
if: ${{ matrix.php != 'nightly' && matrix.php < 7.0 }} | |
run: composer lint-lt70 | |
- name: "Lint PHP files against parse errors - PHP 7.0" | |
if: ${{ matrix.php == '7.0' }} | |
run: composer lint70 | |
- name: "Lint PHP files against parse errors - PHP 7.1 - 7.4" | |
if: ${{ startsWith( matrix.php, '7' ) && matrix.php != '7.0' }} | |
run: composer lint7 | |
- name: "Lint PHP files against parse errors - PHP 8.0 - 8.3" | |
if: ${{ matrix.php != 'nightly' && matrix.php >= 8.0 && matrix.php < 8.4 }} | |
run: composer lint-gte80 | |
- name: "Lint PHP files against parse errors - PHP >= 8.4" | |
if: ${{ matrix.php == 'nightly' || matrix.php >= 8.4 }} | |
run: composer lint-gte84 |