Skip to content

Commit 0391e67

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents d000775 + a331245 commit 0391e67

8 files changed

Lines changed: 499 additions & 124 deletions

File tree

.github/workflows/phpunit-tests.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434
# Confirm any changes to relevant workflow files.
3535
- '.github/workflows/phpunit-tests.yml'
3636
- '.github/workflows/reusable-phpunit-tests-*.yml'
37+
- '.github/workflows/reusable-prepare-gutenberg.yml'
3738
workflow_dispatch:
3839
# Once weekly On Sundays at 00:00 UTC.
3940
schedule:
@@ -51,6 +52,20 @@ concurrency:
5152
permissions: {}
5253

5354
jobs:
55+
# Downloads and verifies the Gutenberg build once for all PHPUnit jobs.
56+
#
57+
# This condition is the union of the conditions on the jobs that need it, reduced.
58+
# The org matrices require `WordPress/wordpress-develop` or a pull request, and the
59+
# fork matrix requires a pull request, so `wordpress-develop` or a pull request
60+
# covers every case. Keep it in step with those jobs: a narrower condition orphans
61+
# them, because a job that needs a skipped job is skipped too, and a broader one
62+
# downloads a build that nothing consumes.
63+
prepare-gutenberg:
64+
uses: ./.github/workflows/reusable-prepare-gutenberg.yml
65+
permissions:
66+
contents: read
67+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
68+
5469
#
5570
# Creates a PHPUnit test job for each PHP/MySQL combination.
5671
#
@@ -61,6 +76,7 @@ jobs:
6176
test-with-mysql:
6277
name: PHP ${{ matrix.php }}
6378
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
79+
needs: prepare-gutenberg
6480
permissions:
6581
contents: read
6682
secrets:
@@ -128,6 +144,8 @@ jobs:
128144
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
129145
tests-domain: ${{ matrix.tests-domain }}
130146
report: ${{ matrix.report || false }}
147+
gutenberg-artifact: gutenberg-build
148+
gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }}
131149

132150
#
133151
# Creates a PHPUnit test job for each PHP/MariaDB combination.
@@ -141,6 +159,7 @@ jobs:
141159
test-with-mariadb:
142160
name: PHP ${{ matrix.php }}
143161
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
162+
needs: prepare-gutenberg
144163
permissions:
145164
contents: read
146165
secrets:
@@ -181,6 +200,8 @@ jobs:
181200
memcached: ${{ matrix.memcached }}
182201
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
183202
report: false
203+
gutenberg-artifact: gutenberg-build
204+
gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }}
184205

185206
#
186207
# Creates PHPUnit test jobs to test MariaDB and MySQL innovation releases.
@@ -196,6 +217,7 @@ jobs:
196217
test-innovation-releases:
197218
name: PHP ${{ matrix.php }}
198219
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
220+
needs: prepare-gutenberg
199221
permissions:
200222
contents: read
201223
secrets:
@@ -228,6 +250,8 @@ jobs:
228250
memcached: ${{ matrix.memcached }}
229251
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
230252
report: false
253+
gutenberg-artifact: gutenberg-build
254+
gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }}
231255

232256
#
233257
# Runs the HTML API test group.
@@ -240,6 +264,7 @@ jobs:
240264
html-api-test-groups:
241265
name: ${{ matrix.label }}
242266
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
267+
needs: prepare-gutenberg
243268
permissions:
244269
contents: read
245270
secrets:
@@ -260,6 +285,8 @@ jobs:
260285
db-type: ${{ matrix.db-type }}
261286
db-version: ${{ matrix.db-version }}
262287
phpunit-test-groups: ${{ matrix.phpunit-test-groups }}
288+
gutenberg-artifact: gutenberg-build
289+
gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }}
263290

264291
#
265292
# Runs unit tests for forks.
@@ -271,6 +298,7 @@ jobs:
271298
limited-matrix-for-forks:
272299
name: PHP ${{ matrix.php }}
273300
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
301+
needs: prepare-gutenberg
274302
permissions:
275303
contents: read
276304
secrets:
@@ -320,14 +348,16 @@ jobs:
320348
db-type: ${{ matrix.db-type }}
321349
memcached: ${{ matrix.memcached || false }}
322350
phpunit-test-groups: ${{ matrix.phpunit-test-groups || '' }}
351+
gutenberg-artifact: gutenberg-build
352+
gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }}
323353

324354
slack-notifications:
325355
name: Slack Notifications
326356
uses: ./.github/workflows/slack-notifications.yml
327357
permissions:
328358
actions: read
329359
contents: read
330-
needs: [ test-with-mysql, test-with-mariadb, test-innovation-releases, html-api-test-groups, limited-matrix-for-forks ]
360+
needs: [ prepare-gutenberg, test-with-mysql, test-with-mariadb, test-innovation-releases, html-api-test-groups, limited-matrix-for-forks ]
331361
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
332362
with:
333363
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}

.github/workflows/reusable-phpunit-tests-v3.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ on:
7272
required: false
7373
type: boolean
7474
default: false
75+
gutenberg-artifact:
76+
description: 'The name of a same-workflow artifact containing the prepared Gutenberg build. Optional: callers that omit it download Gutenberg per job.'
77+
required: false
78+
type: string
79+
default: ''
80+
gutenberg-sha:
81+
description: 'The immutable Gutenberg source SHA verified by the calling workflow.'
82+
required: false
83+
type: string
84+
default: ''
7585
secrets:
7686
CODECOV_TOKEN:
7787
description: 'The Codecov token required for uploading reports.'
@@ -101,6 +111,7 @@ jobs:
101111
# Performs the following steps:
102112
# - Sets environment variables.
103113
# - Checks out the repository.
114+
# - Downloads the prepared Gutenberg build provided by the calling workflow.
104115
# - Sets up Node.js.
105116
# - Sets up PHP.
106117
# - Installs Composer dependencies.
@@ -135,6 +146,17 @@ jobs:
135146
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
136147
persist-credentials: false
137148

149+
# Branches >= 5.9 call this workflow at @trunk without the producer job, so they
150+
# pass no artifact. They skip this step and fall back to a per-job download.
151+
- name: Download prepared Gutenberg build
152+
if: inputs.gutenberg-artifact != ''
153+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
154+
with:
155+
# Without a run ID, this action reads only from the caller's current workflow run.
156+
name: ${{ inputs.gutenberg-artifact }}
157+
path: gutenberg
158+
digest-mismatch: error
159+
138160
- name: Set up Node.js
139161
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
140162
with:
@@ -166,6 +188,9 @@ jobs:
166188

167189
- name: Build WordPress
168190
run: npm run build:dev
191+
env:
192+
# The producer resolved this once. Matrix jobs must not re-resolve mutable GHCR tags.
193+
GUTENBERG_EXPECTED_SHA: ${{ inputs.gutenberg-sha }}
169194

170195
- name: General debug information
171196
run: |

.github/workflows/test-coverage.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
paths:
99
- '.github/workflows/test-coverage.yml'
1010
- '.github/workflows/reusable-phpunit-tests-v3.yml'
11+
- '.github/workflows/reusable-prepare-gutenberg.yml'
12+
- 'tools/gutenberg/**'
13+
- 'package*.json'
14+
- '.nvmrc'
1115
- 'docker-compose.yml'
1216
- 'phpunit.xml.dist'
1317
- 'tests/phpunit/multisite.xml'
@@ -17,6 +21,10 @@ on:
1721
paths:
1822
- '.github/workflows/test-coverage.yml'
1923
- '.github/workflows/reusable-phpunit-tests-v3.yml'
24+
- '.github/workflows/reusable-prepare-gutenberg.yml'
25+
- 'tools/gutenberg/**'
26+
- 'package*.json'
27+
- '.nvmrc'
2028
- 'docker-compose.yml'
2129
- 'phpunit.xml.dist'
2230
- 'tests/phpunit/multisite.xml'
@@ -42,12 +50,20 @@ env:
4250
PUPPETEER_SKIP_DOWNLOAD: true
4351

4452
jobs:
53+
# Downloads and verifies the Gutenberg build once for all coverage jobs.
54+
prepare-gutenberg:
55+
uses: ./.github/workflows/reusable-prepare-gutenberg.yml
56+
permissions:
57+
contents: read
58+
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
59+
4560
#
4661
# Creates a PHPUnit test jobs for generating code coverage reports.
4762
#
4863
test-coverage-report:
4964
name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report
5065
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
66+
needs: prepare-gutenberg
5167
permissions:
5268
contents: read
5369
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
@@ -60,6 +76,8 @@ jobs:
6076
php: '8.3'
6177
multisite: ${{ matrix.multisite }}
6278
coverage-report: ${{ matrix.coverage-report }}
79+
gutenberg-artifact: gutenberg-build
80+
gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }}
6381
secrets:
6482
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6583

@@ -69,7 +87,7 @@ jobs:
6987
permissions:
7088
actions: read
7189
contents: read
72-
needs: [ test-coverage-report ]
90+
needs: [ prepare-gutenberg, test-coverage-report ]
7391
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
7492
with:
7593
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ npm run test:php -- --filter <test name>
9797
npm run test:php -- --group <group name or ticket number>
9898
```
9999

100+
To run the JavaScript (QUnit) tests:
101+
102+
```
103+
npm run grunt qunit:compiled
104+
```
105+
106+
`qunit:compiled` builds first, then runs the suite. The QUnit runner loads
107+
scripts from the built `build/` directory, so a plain `npm run grunt qunit`
108+
requires a completed `npm run build` first without a build, every test fails
109+
with a `jQuery is not defined` error.
110+
100111
#### To lint the workflow files
101112

102113
GitHub Actions workflows operate in a privileged software supply chain environment, therefore all workflow files must adhere to a high degree of quality and security standards.

package-lock.json

Lines changed: 4 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@
112112
"whatwg-fetch": "3.6.20",
113113
"wicg-inert": "3.1.3"
114114
},
115+
"overrides": {
116+
"zod": "3.25.1"
117+
},
115118
"scripts": {
116119
"build": "grunt build",
117120
"build:dev": "grunt build --dev",

0 commit comments

Comments
 (0)