Skip to content

Commit 1382aa4

Browse files
committed
Merge remote-tracking branch 'upstream/trunk' into update/nodejs-20
2 parents a7c5b0e + cfecc5c commit 1382aa4

File tree

342 files changed

+7838
-4545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+7838
-4545
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ concurrency:
1515
# Any needed permissions should be configured at the job level.
1616
permissions: {}
1717

18-
# Exposes WordPress builds as a GitHub artifact to enable
18+
env:
19+
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
20+
21+
# Exposes WordPress builds as a GitHub artifact to enable
1922
# previewing Pull Requests inside WordPress Playground.
20-
#
23+
#
2124
# @see https://github.com/WordPress/wordpress-playground/pull/700
2225
# @see https://github.com/WordPress/wordpress-develop/pull/5481
2326
jobs:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
##
2+
# A callable workflow that tests the WordPress Core build process.
3+
##
4+
name: Test the WordPress Build Process
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
os:
10+
description: 'Operating system to run tests on'
11+
required: false
12+
type: 'string'
13+
default: 'ubuntu-latest'
14+
directory:
15+
description: 'Directory to run WordPress from. Valid values are `src` or `build`'
16+
required: false
17+
type: 'string'
18+
default: 'src'
19+
20+
env:
21+
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
22+
23+
jobs:
24+
# Verifies that installing npm dependencies and building WordPress works as expected.
25+
#
26+
# Performs the following steps:
27+
# - Checks out the repository.
28+
# - Sets up Node.js.
29+
# - Logs debug information about the GitHub Action runner.
30+
# - Installs npm dependencies.
31+
# - Builds WordPress to run from the desired location (src or build).
32+
# - Ensures version-controlled files are not modified or deleted.
33+
# - Cleans up after building WordPress.
34+
# - Ensures version-controlled files are not modified or deleted.
35+
build-process-tests:
36+
name: Core running from ${{ inputs.directory }} / ${{ inputs.os == 'macos-latest' && 'MacOS' || inputs.os == 'windows-latest' && 'Windows' || 'Linux' }}
37+
runs-on: ${{ inputs.os }}
38+
timeout-minutes: 20
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
43+
with:
44+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
45+
46+
- name: Set up Node.js
47+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
48+
with:
49+
node-version-file: '.nvmrc'
50+
cache: npm
51+
52+
- name: Log debug information
53+
run: |
54+
npm --version
55+
node --version
56+
curl --version
57+
git --version
58+
svn --version
59+
60+
- name: Install npm Dependencies
61+
run: npm ci
62+
63+
- name: Build WordPress to run from ${{ inputs.directory }}
64+
run: npm run build${{ inputs.directory == 'src' && ':dev' || '' }}
65+
66+
- name: Ensure version-controlled files are not modified or deleted during building
67+
run: git diff --exit-code
68+
69+
- name: Clean after building to run from ${{ inputs.directory }}
70+
run: npm run grunt clean${{ inputs.directory == 'src' && ' -- --dev' || '' }}
71+
72+
- name: Ensure version-controlled files are not modified or deleted during cleaning
73+
run: git diff --exit-code
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
##
2+
# A callable workflow that tests the Gutenberg plugin build process when run within a wordpress-develop checkout.
3+
##
4+
name: Test the Gutenberg plugin Build Process
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
os:
10+
description: 'Operating system to run tests on'
11+
required: false
12+
type: 'string'
13+
default: 'ubuntu-latest'
14+
directory:
15+
description: 'Directory to run WordPress from. Valid values are `src` or `build`'
16+
required: false
17+
type: 'string'
18+
default: 'src'
19+
20+
env:
21+
GUTENBERG_DIRECTORY: ${{ inputs.directory == 'build' && 'build' || 'src' }}/wp-content/plugins/gutenberg
22+
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
23+
24+
jobs:
25+
# Verifies that installing npm dependencies and building the Gutenberg plugin works as expected.
26+
#
27+
# Performs the following steps:
28+
# - Checks out the repository.
29+
# - Checks out the Gutenberg plugin into the plugins directory.
30+
# - Sets up Node.js.
31+
# - Logs debug information about the GitHub Action runner.
32+
# - Installs Core npm dependencies.
33+
# - Installs Gutenberg npm dependencies.
34+
# - Runs the Gutenberg build process.
35+
# - Builds WordPress to run from the relevant location (src or build).
36+
# - Builds Gutenberg.
37+
# - Ensures version-controlled files are not modified or deleted.
38+
build-process-tests:
39+
name: Gutenberg running from ${{ inputs.directory }} / ${{ inputs.os == 'macos-latest' && 'MacOS' || inputs.os == 'windows-latest' && 'Windows' || 'Linux' }}
40+
runs-on: ${{ inputs.os }}
41+
timeout-minutes: 30
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
46+
with:
47+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
48+
49+
- name: Checkout Gutenberg plugin
50+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
51+
with:
52+
repository: 'WordPress/gutenberg'
53+
path: ${{ env.GUTENBERG_DIRECTORY }}
54+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
55+
56+
- name: Set up Node.js
57+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
58+
with:
59+
node-version-file: '.nvmrc'
60+
cache: npm
61+
cache-dependency-path: |
62+
package-lock.json
63+
${{ env.GUTENBERG_DIRECTORY }}/package-lock.json
64+
65+
- name: Log debug information
66+
run: |
67+
npm --version
68+
node --version
69+
curl --version
70+
git --version
71+
svn --version
72+
73+
- name: Install Core Dependencies
74+
run: npm ci
75+
76+
- name: Install Gutenberg Dependencies
77+
run: npm ci
78+
working-directory: ${{ env.GUTENBERG_DIRECTORY }}
79+
80+
- name: Build Gutenberg
81+
run: npm run build
82+
working-directory: ${{ env.GUTENBERG_DIRECTORY }}
83+
84+
- name: Build WordPress to run from ${{ inputs.directory }}
85+
run: npm run build${{ inputs.directory == 'src' && ':dev' || '' }}
86+
87+
- name: Run Gutenberg build script after building Core to run from ${{ inputs.directory }}
88+
run: npm run build
89+
working-directory: ${{ env.GUTENBERG_DIRECTORY }}
90+
91+
- name: Ensure version-controlled files are not modified or deleted during building
92+
run: git diff --exit-code

.github/workflows/failed-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
runs-on: ubuntu-latest
2727
permissions:
2828
actions: write
29-
timeout-minutes: 20
29+
timeout-minutes: 30
3030

3131
steps:
3232
- name: Rerun a workflow
3333
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
3434
with:
35-
retries: 10
35+
retries: 15
3636
retry-exempt-status-codes: 418
3737
script: |
3838
const workflow_run = await github.rest.actions.getWorkflowRun({

.github/workflows/performance.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
runs-on: ubuntu-latest
9393
permissions:
9494
contents: read
95-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
95+
if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }}
9696

9797
steps:
9898
- name: Configure environment variables
@@ -162,6 +162,12 @@ jobs:
162162
run: |
163163
npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path=/var/www/${{ env.LOCAL_DIR }}
164164
165+
- name: Install additional languages
166+
run: |
167+
npm run env:cli -- language core install de_DE --path=/var/www/${{ env.LOCAL_DIR }}
168+
npm run env:cli -- language plugin install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }}
169+
npm run env:cli -- language theme install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }}
170+
165171
- name: Install MU plugin
166172
run: |
167173
mkdir ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Test Build Processes
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
- '3.[7-9]'
8+
- '[4-9].[0-9]'
9+
tags:
10+
- '[0-9]+.[0-9]'
11+
- '[0-9]+.[0-9].[0-9]+'
12+
pull_request:
13+
branches:
14+
- trunk
15+
- '3.[7-9]'
16+
- '[4-9].[0-9]'
17+
paths:
18+
# These files configure npm. Changes could affect the outcome.
19+
- 'package*.json'
20+
# JavaScript files are built using npm.
21+
- '**.js'
22+
# CSS and SCSS files are built using npm.
23+
- '**.scss'
24+
- '**.css'
25+
# Changes to workflow files should always verify all workflows are successful.
26+
- '.github/workflows/**.yml'
27+
workflow_dispatch:
28+
29+
# Cancels all previous workflow runs for pull requests that have not completed.
30+
concurrency:
31+
# The concurrency group contains the workflow name and the branch name for pull requests
32+
# or the commit hash for any other events.
33+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
34+
cancel-in-progress: true
35+
36+
# Disable permissions for all available scopes by default.
37+
# Any needed permissions should be configured at the job level.
38+
permissions: {}
39+
40+
jobs:
41+
# Tests the WordPress Core build process on multiple operating systems.
42+
test-core-build-process:
43+
name: Core running from ${{ matrix.directory }}
44+
uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk
45+
permissions:
46+
contents: read
47+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
os: [ ubuntu-latest, windows-latest ]
52+
directory: [ 'src', 'build' ]
53+
with:
54+
os: ${{ matrix.os }}
55+
directory: ${{ matrix.directory }}
56+
57+
# Tests the WordPress Core build process on MacOS.
58+
#
59+
# This is separate from the job above in order to use stricter conditions when determining when to run.
60+
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
61+
#
62+
# The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
63+
# currently no way to determine the OS being used on a given job.
64+
# See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
65+
test-core-build-process-macos:
66+
name: Core running from ${{ matrix.directory }}
67+
uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk
68+
permissions:
69+
contents: read
70+
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
os: [ macos-latest ]
75+
directory: [ 'src', 'build' ]
76+
with:
77+
os: ${{ matrix.os }}
78+
directory: ${{ matrix.directory }}
79+
80+
# Tests the Gutenberg plugin build process on multiple operating systems when run within a wordpress-develop checkout.
81+
test-gutenberg-build-process:
82+
name: Gutenberg running from ${{ matrix.directory }}
83+
uses: WordPress/wordpress-develop/.github/workflows/callable-test-gutenberg-build-process.yml@trunk
84+
permissions:
85+
contents: read
86+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
87+
strategy:
88+
fail-fast: false
89+
matrix:
90+
os: [ ubuntu-latest, windows-latest ]
91+
directory: [ 'src', 'build' ]
92+
with:
93+
os: ${{ matrix.os }}
94+
directory: ${{ matrix.directory }}
95+
96+
# Tests the Gutenberg plugin build process on MacOS when run within a wordpress-develop checkout.
97+
#
98+
# This is separate from the job above in order to use stricter conditions when determining when to run.
99+
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
100+
#
101+
# The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
102+
# currently no way to determine the OS being used on a given job.
103+
# See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
104+
test-gutenberg-build-process-macos:
105+
name: Gutenberg running from ${{ matrix.directory }}
106+
uses: WordPress/wordpress-develop/.github/workflows/callable-test-gutenberg-build-process.yml@trunk
107+
permissions:
108+
contents: read
109+
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
os: [ macos-latest ]
114+
directory: [ 'src', 'build' ]
115+
with:
116+
os: ${{ matrix.os }}
117+
directory: ${{ matrix.directory }}
118+
119+
slack-notifications:
120+
name: Slack Notifications
121+
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
122+
permissions:
123+
actions: read
124+
contents: read
125+
needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ]
126+
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
127+
with:
128+
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
129+
secrets:
130+
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
131+
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
132+
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
133+
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
134+
135+
failed-workflow:
136+
name: Failed workflow tasks
137+
runs-on: ubuntu-latest
138+
permissions:
139+
actions: write
140+
needs: [ slack-notifications ]
141+
if: |
142+
always() &&
143+
github.repository == 'WordPress/wordpress-develop' &&
144+
github.event_name != 'pull_request' &&
145+
github.run_attempt < 2 &&
146+
(
147+
contains( needs.*.result, 'cancelled' ) ||
148+
contains( needs.*.result, 'failure' )
149+
)
150+
151+
steps:
152+
- name: Dispatch workflow run
153+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
154+
with:
155+
retries: 2
156+
retry-exempt-status-codes: 418
157+
script: |
158+
github.rest.actions.createWorkflowDispatch({
159+
owner: context.repo.owner,
160+
repo: context.repo.repo,
161+
workflow_id: 'failed-workflow.yml',
162+
ref: 'trunk',
163+
inputs: {
164+
run_id: '${{ github.run_id }}'
165+
}
166+
});

0 commit comments

Comments
 (0)