Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/phpunit-tests-full-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: PHPUnit Tests (label)
run-name: PHPUnit Tests${{ github.event.label.name == 'Full PHPUnit Matrix' && ' (full matrix)' || ' (ignored label)' }}

on:
pull_request:
types: [ labeled ]
branches:
- trunk
- '3.[7-9]'
- '[4-9].[0-9]'
# Keep these paths in sync with phpunit-tests.yml.
paths:
- '**'
# Documentation and repository metadata.
- '!**.md'
- '!.devcontainer/**'
- '!.editorconfig'
- '!.git-blame-ignore-revs'
- '!.gitignore'
- '!.mailmap'
- '!typings/**'
# Configuration for unrelated checks.
- '!.eslintrc-jsdoc.js'
- '!.prettierrc.js'
- '!.version-support-*.json'
- '!eslint.config.js'
- '!jsdoc.conf.json'
- '!phpcompat.xml.dist'
- '!phpcs.xml.dist'
- '!phpstan.neon.dist'
- '!tsconfig.json'
# Other test suites, tools, and workflows do not affect these tests.
- '!tests/**'
- '!tools/**'
- '!.github/**'
# Re-include documentation, tests, tools, and workflows used here.
- 'SECURITY.md'
- 'src/license.txt'
- 'tests/phpunit/**'
- 'tools/gutenberg/**'
- 'tools/local-env/**'
- 'tools/vendors/**'
- 'tools/webpack/**'
- 'phpunit.xml.dist'
- '.github/workflows/phpunit-tests.yml'
- '.github/workflows/phpunit-tests-full-matrix.yml'
- '.github/workflows/reusable-phpunit-tests-*.yml'
- '.github/workflows/reusable-prepare-gutenberg.yml'

# Disable permissions for all available scopes by default.
permissions: {}

# The called workflow manages concurrency. Unrelated labels never enter it.
jobs:
full-matrix:
if: github.event.label.name == 'Full PHPUnit Matrix'
permissions:
# Required by the called workflow's recovery job, which is skipped on PR events.
actions: write
contents: read
uses: ./.github/workflows/phpunit-tests.yml
secrets:
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
41 changes: 31 additions & 10 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: PHPUnit Tests
run-name: PHPUnit Tests${{ ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && ' (full matrix)' || '' }}

on:
push:
Expand All @@ -11,6 +12,7 @@ on:
- trunk
- '3.[7-9]'
- '[4-9].[0-9]'
# Keep these paths in sync with phpunit-tests-full-matrix.yml.
paths:
- '**'
# Documentation and repository metadata.
Expand Down Expand Up @@ -45,9 +47,26 @@ on:
- 'tools/webpack/**'
- 'phpunit.xml.dist'
- '.github/workflows/phpunit-tests.yml'
- '.github/workflows/phpunit-tests-full-matrix.yml'
- '.github/workflows/reusable-phpunit-tests-*.yml'
- '.github/workflows/reusable-prepare-gutenberg.yml'
workflow_dispatch:
workflow_call:
secrets:
CODEVITALS_PROJECT_TOKEN:
required: false
CODECOV_TOKEN:
required: false
WPT_REPORT_API_KEY:
required: false
SLACK_GHA_SUCCESS_WEBHOOK:
required: false
SLACK_GHA_CANCELLED_WEBHOOK:
required: false
SLACK_GHA_FIXED_WEBHOOK:
required: false
SLACK_GHA_FAILURE_WEBHOOK:
required: false
# Once weekly On Sundays at 00:00 UTC.
schedule:
- cron: '0 0 * * 0'
Expand Down Expand Up @@ -110,10 +129,11 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-24.04 ]
# The scheduled run tests every supported PHP version. Other events test the highest and lowest of each major.
php: ${{ github.event_name == 'schedule' && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.0","8.5"]') }}
# Scheduled and labeled runs test every supported PHP version. Other runs test the highest and lowest of each major.
php: ${{ ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.0","8.5"]') }}
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.4', '9.7' ]
# Scheduled and labeled runs test the full database matrix. Other runs retain MySQL 5.7 compatibility and the widely used 8.x releases.
db-version: ${{ ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && fromJSON('["5.7","8.0","8.4","9.7"]') || fromJSON('["5.7","8.0","8.4"]') }}
tests-domain: [ 'example.org' ]
multisite: [ false, true ]
memcached: [ false ]
Expand Down Expand Up @@ -173,8 +193,8 @@ jobs:
#
# Creates a PHPUnit test job for each PHP/MariaDB combination.
#
# All LTS versions of MariaDB supported by WordPress with greater than 1% usage according to w.org/stats should be
# tested. The exceptions to this rule are the most recent LTS and version 5.5.
# Scheduled and labeled runs test all LTS versions of MariaDB supported by WordPress with greater than 1% usage
# according to w.org/stats. The exceptions to this rule are the most recent LTS and version 5.5.
#
# The 5.5 release was intended as a drop-in replacement for MySQL. Because the MySQL 5.5 Docker containers do not
# work, this ensures some level of MySQL 5.5 testing.
Expand Down Expand Up @@ -202,10 +222,11 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-24.04 ]
# The scheduled run tests every supported PHP version. Other events test the highest and lowest of each major.
php: ${{ github.event_name == 'schedule' && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.0","8.5"]') }}
# Scheduled and labeled runs test every supported PHP version. Other runs test the highest and lowest of each major.
php: ${{ ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.0","8.5"]') }}
db-type: [ 'mariadb' ]
db-version: [ '5.5', '10.3', '10.5', '10.6', '10.11', '11.4', '11.8' ]
# Scheduled and labeled runs test the full database matrix. Other runs retain MariaDB 5.5 compatibility, 10.6, and newer LTS releases.
db-version: ${{ ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && fromJSON('["5.5","10.3","10.5","10.6","10.11","11.4","11.8"]') || fromJSON('["5.5","10.6","10.11","11.4","11.8"]') }}
multisite: [ false, true ]
memcached: [ false ]

Expand Down Expand Up @@ -269,8 +290,8 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-24.04 ]
# The scheduled run tests every supported PHP version. Other events test the highest and lowest of each major.
php: ${{ github.event_name == 'schedule' && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.0","8.5"]') }}
# Scheduled and labeled runs test every supported PHP version. Other runs test the highest and lowest of each major.
php: ${{ ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.0","8.5"]') }}
db-type: [ 'mysql', 'mariadb' ]
db-version: [ '12.1' ]
multisite: [ false, true ]
Expand Down
12 changes: 12 additions & 0 deletions tests/phpunit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ PHPUnit is the official testing framework chosen by the core team to test PHP co
For more information, please review the relevant Core Handbook pages:
- [PHP: PHPUnit](https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/)
- [Writing PHP Tests](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/)

## Run the full matrix on a pull request

Add the `Full PHPUnit Matrix` label to a pull request in `WordPress/wordpress-develop` to run the same PHP and database combinations as the weekly scheduled run. The label-triggered workflow uses the same path filters as normal PHPUnit runs.

If you cannot apply labels, leave a PR comment asking a reviewer with triage access to add it. Fork PRs follow GitHub's usual workflow approval requirements.

Adding the label starts a separate run without another code push. An existing reduced-matrix run continues alongside it; its checks and results are preserved. New commits run the full matrix while the label remains. Remove and reapply it to request another run for the current revision, or remove it to return subsequent runs to the reduced matrix.

Unrelated labels skip only the label-triggered workflow's `full-matrix` job and do not replace or cancel PHPUnit checks.

Look for `PHPUnit Tests (full matrix)` in GitHub Actions and the PHPUnit checks on the PR. Each run tests the PR's merge commit and retains its own logs and results, so check the revision before relying on an older run.
Loading