Merge pull request #909 from WordPress/feature/ghactions-update-for-p… #1735
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: | |
lint: #---------------------------------------------------------------------- | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Lint against the high/low versions of each PHP major + nightly. | |
php: ['5.6', '7.0', '7.4', '8.0', '8.4', '8.5'] | |
name: "Lint: PHP ${{ matrix.php }}" | |
continue-on-error: ${{ matrix.php == '8.5' }} | |
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=-1, display_errors=On, log_errors_max_len=0 | |
coverage: none | |
tools: cs2pr | |
# 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.5' }} | |
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") | |
# For PHP "nightly", we need to install with ignore platform reqs. | |
- name: Install Composer dependencies - with ignore platform | |
if: ${{ matrix.php == '8.5' }} | |
uses: "ramsey/composer-install@v3" | |
with: | |
composer-options: "--ignore-platform-req=php+" | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Lint against parse errors | |
if: ${{ matrix.php >= '7.2' }} | |
run: composer lint -- --checkstyle | cs2pr | |
- name: Lint against parse errors | |
if: ${{ matrix.php < '7.2' }} | |
run: composer lint -- --exclude build --checkstyle | cs2pr |