Merge pull request #802 from Automattic/feature/ghactions-minor-tweaks #236
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: Quicktest | |
on: | |
# Run on pushes, including merges, to all branches except `main`. | |
push: | |
branches-ignore: | |
- main | |
paths-ignore: | |
- '**.md' | |
# 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: | |
#### QUICK TEST STAGE #### | |
# This is a much quicker test which only runs the unit tests and linting against the low/high | |
# supported PHP/PHPCS combinations. | |
quicktest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- php: '5.4' | |
dependencies: 'stable' | |
- php: '5.4' | |
dependencies: 'lowest' | |
- php: 'latest' | |
dependencies: 'stable' | |
- php: 'latest' | |
dependencies: 'lowest' | |
name: "QTest${{ matrix.dependencies == 'stable' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
# With stable PHPCS dependencies, allow for PHP deprecation notices. | |
# Unit tests shouldn't fail on those for stable releases where those issues won't get fixed anymore. | |
ini-values: error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On | |
coverage: none | |
# 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: ${{ startsWith( matrix.php, '8' ) == false && matrix.php != 'latest' }} | |
uses: "ramsey/composer-install@v2" | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform | |
# requirements to get PHPUnit 7.x to install on nightly. | |
- name: Install Composer dependencies - with ignore platform | |
if: ${{ startsWith( matrix.php, '8' ) || matrix.php == 'latest' }} | |
uses: "ramsey/composer-install@v2" | |
with: | |
composer-options: --ignore-platform-req=php+ | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: "Composer: downgrade PHPCS dependencies for tests (lowest)" | |
if: ${{ matrix.php == '5.4' && matrix.dependencies == 'lowest' }} | |
run: > | |
composer update --prefer-lowest --no-scripts --no-interaction | |
squizlabs/php_codesniffer | |
phpcsstandards/phpcsutils | |
phpcsstandards/phpcsextra | |
sirbrillig/phpcs-variable-analysis | |
wp-coding-standards/wpcs | |
- name: "Composer: downgrade PHPCS dependencies for tests (lowest) - with ignore platform" | |
if: ${{ matrix.php == 'latest' && matrix.dependencies == 'lowest' }} | |
run: > | |
composer update --prefer-lowest --no-scripts --no-interaction --ignore-platform-req=php+ | |
squizlabs/php_codesniffer | |
phpcsstandards/phpcsutils | |
phpcsstandards/phpcsextra | |
sirbrillig/phpcs-variable-analysis | |
wp-coding-standards/wpcs | |
- name: Display PHPCS installed standards | |
run: ./vendor/bin/phpcs -i | |
- name: Lint against parse errors | |
if: matrix.dependencies == 'stable' | |
run: ./bin/php-lint | |
- name: Run the unit tests | |
run: ./bin/unit-tests | |
- name: Run the ruleset tests | |
run: ./bin/ruleset-tests |