Skip to content

Commit 0a41bb4

Browse files
committed
Build/Test Tools: Trim PHPUnit runs in 7.0.
Keep boundary PHP versions and a reduced database matrix for routine runs. Restore the full PHP and database lists for dispatched runs and pull requests with the Full PHPUnit Matrix label. Merges [63584], [63585], and [63779] to the 7.0 branch, adapted to its supported versions and scheduled dispatches. Developed in: #13638 Reviewed by: desrosj. Props adrianmoldovanwp, desrosj, lucatume. See #66071. See #66069. git-svn-id: https://develop.svn.wordpress.org/branches/7.0@63892 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7f15404 commit 0a41bb4

3 files changed

Lines changed: 134 additions & 6 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: PHPUnit Tests (label)
2+
run-name: PHPUnit Tests${{ github.event.label.name == 'Full PHPUnit Matrix' && ' (full matrix)' || ' (ignored label)' }}
3+
4+
on:
5+
pull_request:
6+
types: [ labeled ]
7+
branches:
8+
- trunk
9+
- '3.[7-9]'
10+
- '[4-9].[0-9]'
11+
# Keep these paths in sync with phpunit-tests.yml.
12+
paths:
13+
# Any change to a PHP, CSS, JavaScript, JSON, HTML, or otherwise tested file should run checks.
14+
- '**.css'
15+
- '**.html'
16+
- '**.js'
17+
- '**.json'
18+
- '**.php'
19+
- 'src/license.txt'
20+
- 'src/SECURITY.md'
21+
# These files configure npm and the task runner. Changes could affect the outcome.
22+
- 'package*.json'
23+
- '.npmrc'
24+
- '.nvmrc'
25+
- 'Gruntfile.js'
26+
# These files configure Composer. Changes could affect the outcome.
27+
- 'composer.*'
28+
# These files affect the phpunit tests. Changes could affect the outcome.
29+
- 'tests/phpunit/**'
30+
- 'tests/phpunit/multisite.xml'
31+
- 'phpunit.xml.dist'
32+
# Confirm any changes to relevant workflow files.
33+
- '.github/workflows/phpunit-tests.yml'
34+
- '.github/workflows/phpunit-tests-full-matrix.yml'
35+
- '.github/workflows/reusable-phpunit-tests-*.yml'
36+
37+
# Disable permissions for all available scopes by default.
38+
permissions: {}
39+
40+
# The called workflow manages concurrency. Unrelated labels never enter it.
41+
jobs:
42+
full-matrix:
43+
if: github.event.label.name == 'Full PHPUnit Matrix'
44+
permissions:
45+
# Required by the called workflow's recovery job, which is skipped on PR events.
46+
actions: write
47+
contents: read
48+
uses: ./.github/workflows/phpunit-tests.yml
49+
secrets:
50+
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}
51+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
52+
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}

‎.github/workflows/phpunit-tests.yml‎

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: PHPUnit Tests
2+
run-name: PHPUnit Tests${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) ) && ' (full matrix)' || '' }}
23

34
on:
45
push:
@@ -11,6 +12,7 @@ on:
1112
- trunk
1213
- '3.[7-9]'
1314
- '[4-9].[0-9]'
15+
# Keep these paths in sync with phpunit-tests-full-matrix.yml.
1416
paths:
1517
# Any change to a PHP, CSS, JavaScript, JSON, HTML, or otherwise tested file should run checks.
1618
- '**.css'
@@ -33,8 +35,25 @@ on:
3335
- 'phpunit.xml.dist'
3436
# Confirm any changes to relevant workflow files.
3537
- '.github/workflows/phpunit-tests.yml'
38+
- '.github/workflows/phpunit-tests-full-matrix.yml'
3639
- '.github/workflows/reusable-phpunit-tests-*.yml'
3740
workflow_dispatch:
41+
workflow_call:
42+
secrets:
43+
CODEVITALS_PROJECT_TOKEN:
44+
required: false
45+
CODECOV_TOKEN:
46+
required: false
47+
WPT_REPORT_API_KEY:
48+
required: false
49+
SLACK_GHA_SUCCESS_WEBHOOK:
50+
required: false
51+
SLACK_GHA_CANCELLED_WEBHOOK:
52+
required: false
53+
SLACK_GHA_FIXED_WEBHOOK:
54+
required: false
55+
SLACK_GHA_FAILURE_WEBHOOK:
56+
required: false
3857
# Once weekly On Sundays at 00:00 UTC.
3958
schedule:
4059
- cron: '0 0 * * 0'
@@ -78,13 +97,27 @@ jobs:
7897
fail-fast: false
7998
matrix:
8099
os: [ ubuntu-24.04 ]
81-
# Test highest and lowest supported version of each major.
82-
php: [ '7.4', '8.0', '8.5' ]
100+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
83101
db-type: [ 'mysql' ]
84102
db-version: [ '5.7', '8.0', '8.4' ]
85103
tests-domain: [ 'example.org' ]
86104
multisite: [ false, true ]
87105
memcached: [ false ]
106+
# Dispatched runs and pull requests labeled 'Full PHPUnit Matrix' test every version above.
107+
# Other runs retain boundary PHP versions and the routine database versions below.
108+
full-matrix:
109+
- ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) }}
110+
111+
exclude:
112+
# Outside the full matrix, test the highest and lowest PHP version of each major.
113+
- full-matrix: false
114+
php: '8.1'
115+
- full-matrix: false
116+
php: '8.2'
117+
- full-matrix: false
118+
php: '8.3'
119+
- full-matrix: false
120+
php: '8.4'
88121

89122
include:
90123
# Include jobs that test with memcached.
@@ -159,12 +192,31 @@ jobs:
159192
fail-fast: false
160193
matrix:
161194
os: [ ubuntu-24.04 ]
162-
# Test highest and lowest supported version of each major.
163-
php: [ '7.4', '8.0', '8.5' ]
195+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
164196
db-type: [ 'mariadb' ]
165197
db-version: [ '5.5', '10.3', '10.5', '10.6', '10.11', '11.4', '11.8' ]
166198
multisite: [ false, true ]
167199
memcached: [ false ]
200+
# Dispatched runs and pull requests labeled 'Full PHPUnit Matrix' test every version above.
201+
# Other runs retain boundary PHP versions and the routine database versions below.
202+
full-matrix:
203+
- ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) }}
204+
205+
exclude:
206+
# Outside the full matrix, test the highest and lowest PHP version of each major.
207+
- full-matrix: false
208+
php: '8.1'
209+
- full-matrix: false
210+
php: '8.2'
211+
- full-matrix: false
212+
php: '8.3'
213+
- full-matrix: false
214+
php: '8.4'
215+
# Keep these database versions in full runs only.
216+
- full-matrix: false
217+
db-version: '10.3'
218+
- full-matrix: false
219+
db-version: '10.5'
168220

169221
include:
170222
# Include jobs that test with memcached.
@@ -215,15 +267,27 @@ jobs:
215267
fail-fast: false
216268
matrix:
217269
os: [ ubuntu-24.04 ]
218-
# Test highest and lowest supported version of each major.
219-
php: [ '7.4', '8.0', '8.5' ]
270+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
220271
db-type: [ 'mysql', 'mariadb' ]
221272
db-version: [ '9.6', '12.1' ]
222273
multisite: [ false, true ]
223274
memcached: [ false ]
224275
db-innovation: [ true ]
276+
# Dispatched runs and pull requests labeled 'Full PHPUnit Matrix' test every version above.
277+
# Other runs retain boundary PHP versions and the routine database versions below.
278+
full-matrix:
279+
- ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'Full PHPUnit Matrix' ) ) }}
225280

226281
exclude:
282+
# Outside the full matrix, test the highest and lowest PHP version of each major.
283+
- full-matrix: false
284+
php: '8.1'
285+
- full-matrix: false
286+
php: '8.2'
287+
- full-matrix: false
288+
php: '8.3'
289+
- full-matrix: false
290+
php: '8.4'
227291
# Exclude version combinations that don't exist.
228292
- db-type: 'mariadb'
229293
db-version: '9.6'

‎tests/phpunit/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@ PHPUnit is the official testing framework chosen by the core team to test PHP co
55
For more information, please review the relevant Core Handbook pages:
66
- [PHP: PHPUnit](https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/)
77
- [Writing PHP Tests](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/)
8+
9+
## Run the full matrix on a pull request
10+
11+
Add the `Full PHPUnit Matrix` label to a pull request in `WordPress/wordpress-develop` to run the same PHP and database combinations as the dispatched run on this branch. The label-triggered workflow uses the same path filters as normal PHPUnit runs.
12+
13+
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.
14+
15+
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.
16+
17+
Unrelated labels skip only the label-triggered workflow's `full-matrix` job and do not replace or cancel PHPUnit checks.
18+
19+
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.

0 commit comments

Comments
 (0)