Skip to content

Commit 286623f

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 7e57bec + 7032470 commit 286623f

2,456 files changed

Lines changed: 224433 additions & 45086 deletions

File tree

Some content is hidden

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

‎.env.example‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ LOCAL_DIR=src
1818
# Valid options are 'on' and 'off'.
1919
LOCAL_NGINX_COMPRESSION=off
2020

21+
# How long browsers may cache static assets served by the web server, as an nginx `expires` value.
22+
# Valid options are 'off' and a duration such as '1y'. A far-future duration matches typical
23+
# production behavior, but edited CSS and JavaScript is then served stale until a hard reload.
24+
LOCAL_NGINX_STATIC_EXPIRES=off
25+
2126
# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
2227
LOCAL_PHP=latest
2328

‎.eslintrc-jsdoc.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module.exports = [
5252
tags: [ 'param', 'property' ],
5353
} ],
5454
'jsdoc/check-param-names': 'error',
55+
'jsdoc/check-property-names': 'error',
5556
'jsdoc/check-syntax': 'error',
5657
'jsdoc/check-tag-names': [ 'error', {
5758
definedTags: [
@@ -62,6 +63,8 @@ module.exports = [
6263
],
6364
} ],
6465
'jsdoc/check-types': 'error',
66+
'jsdoc/no-blank-blocks': 'error',
67+
'jsdoc/no-blank-block-descriptions': 'error',
6568
'jsdoc/require-description': 'error',
6669
'jsdoc/require-hyphen-before-param-description': [ 'error', 'never' ],
6770
'jsdoc/require-jsdoc': 'error',
@@ -71,10 +74,15 @@ module.exports = [
7174
'jsdoc/require-param-description': 'error',
7275
'jsdoc/require-param-name': 'error',
7376
'jsdoc/require-param-type': 'error',
77+
'jsdoc/require-property': 'error',
78+
'jsdoc/require-property-name': 'error',
79+
'jsdoc/require-property-description': 'error',
80+
'jsdoc/require-property-type': 'error',
7481
'jsdoc/require-returns': 'error',
7582
'jsdoc/require-returns-check': 'error',
7683
'jsdoc/require-returns-description': 'error',
7784
'jsdoc/require-returns-type': 'error',
85+
'jsdoc/valid-types': 'error',
7886
},
7987
},
8088
];

‎.github/actionlint.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# actionlint does not support the `$/` self-repository `uses:` syntax yet.
2+
# See https://github.com/rhysd/actionlint/issues/711.
3+
paths:
4+
.github/workflows/**/*.yml:
5+
ignore:
6+
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Download with retry'
2+
description: 'Downloads a file with curl, retrying on any error.'
3+
4+
inputs:
5+
url:
6+
description: 'The URL to download.'
7+
required: true
8+
output:
9+
description: 'The path to save the file to, relative to the workspace.'
10+
required: true
11+
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: Download the file
16+
shell: bash
17+
# A stalled attempt (connecting for over 30 s, or under 1 KB/s for 30 s) fails and is
18+
# retried: curl has no transfer timeout, and `timeout-minutes` would end the step unretried.
19+
# No retry starts after 10 minutes, so a long `Retry-After` can't stretch the waits.
20+
run: curl --fail --no-progress-meter --location --retry 5 --retry-all-errors --retry-max-time 600 --connect-timeout 30 --speed-limit 1024 --speed-time 30 --output "$OUTPUT" "$URL"
21+
env:
22+
URL: ${{ inputs.url }}
23+
OUTPUT: ${{ inputs.output }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Run with retry'
2+
description: 'Runs a Bash command, retrying it when it fails. For downloads curl can retry itself, use download-with-retry.'
3+
4+
inputs:
5+
command:
6+
description: 'The Bash command to run. It runs as code: read values from the `env` of the calling step, not from expressions.'
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Run the command
13+
shell: bash
14+
# Waits 10 s, then 20 s, between attempts, like `tools/local-env/scripts/utils.js`.
15+
run: |
16+
for (( attempt = 1; attempt <= MAX_ATTEMPTS; attempt++ )); do
17+
if bash -eo pipefail -c "$COMMAND"; then
18+
exit 0
19+
fi
20+
echo "::warning::Command failed on attempt $attempt of $MAX_ATTEMPTS."
21+
if (( attempt < MAX_ATTEMPTS )); then
22+
sleep $(( attempt * 10 ))
23+
fi
24+
done
25+
exit 1
26+
env:
27+
COMMAND: ${{ inputs.command }}
28+
MAX_ATTEMPTS: 3
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 'Set up npm'
2+
description: 'Installs the npm version required by the devEngines field of package.json, so every job resolves dependencies identically. Keeps the bundled npm when the field is absent.'
3+
4+
inputs:
5+
working-directory:
6+
description: 'Optional. The directory holding the package.json to read the required npm version from. Defaults to the workspace root.'
7+
required: false
8+
default: '.'
9+
cache:
10+
description: 'Optional. Whether to restore and save the npm cache. Defaults to true.'
11+
required: false
12+
default: 'true'
13+
14+
runs:
15+
using: 'composite'
16+
steps:
17+
- name: Install npm
18+
id: npm
19+
env:
20+
WORKING_DIRECTORY: ${{ inputs.working-directory }}
21+
NPM_INSTALL_MAX_ATTEMPTS: 3
22+
run: |
23+
NPM_VERSION="$(jq -r '.devEngines.packageManager.version // empty' package.json)"
24+
if [ -n "$NPM_VERSION" ]; then
25+
# Contributors need the floor; CI stays on that major's newest release.
26+
# The registry can reset the connection mid-download (ECONNRESET), so retry.
27+
for (( attempt = 1; attempt <= NPM_INSTALL_MAX_ATTEMPTS; attempt++ )); do
28+
if npm install --global "npm@${NPM_VERSION/>=/^}"; then
29+
break
30+
fi
31+
echo "::warning::npm install failed on attempt $attempt of $NPM_INSTALL_MAX_ATTEMPTS."
32+
if (( attempt == NPM_INSTALL_MAX_ATTEMPTS )); then
33+
exit 1
34+
fi
35+
sleep $(( attempt * 10 ))
36+
done
37+
echo "Required npm version: $NPM_VERSION"
38+
else
39+
echo "No devEngines.packageManager.version, keeping the bundled npm."
40+
fi
41+
echo "Installed npm version: $(npm --version)"
42+
43+
# actions/setup-node cannot restore the npm cache: it locates the
44+
# directory with `npm config get cache`, which runs before this step
45+
# and fails the devEngines check under the bundled npm.
46+
echo "cache-dir=$(npm config get cache | tr -d '\r')" >> "$GITHUB_OUTPUT"
47+
48+
# Scopes the cache key to this package and keeps the hashFiles patterns
49+
# workspace-relative and free of a "./" prefix, so they match the same
50+
# files as every other cache key.
51+
PATH_PREFIX=""
52+
if [ "$WORKING_DIRECTORY" != '.' ] && [ -n "$WORKING_DIRECTORY" ]; then
53+
PATH_PREFIX="${WORKING_DIRECTORY%/}/"
54+
fi
55+
echo "path-prefix=$PATH_PREFIX" >> "$GITHUB_OUTPUT"
56+
working-directory: ${{ inputs.working-directory }}
57+
shell: bash
58+
59+
- name: Cache npm downloads
60+
if: ${{ inputs.cache == 'true' }}
61+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
62+
with:
63+
path: ${{ steps.npm.outputs.cache-dir }}
64+
key: npm-cache-${{ runner.os }}-${{ runner.arch }}-${{ steps.npm.outputs.path-prefix }}lock-${{ hashFiles(format('{0}package-lock.json', steps.npm.outputs.path-prefix), format('{0}patches/**', steps.npm.outputs.path-prefix)) }}
65+
restore-keys: |
66+
npm-cache-${{ runner.os }}-${{ runner.arch }}-${{ steps.npm.outputs.path-prefix }}lock-
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Set up WP-CLI'
2+
description: 'Installs WP-CLI as `wp`, retrying the download and falling back to a previously cached phar when it fails.'
3+
4+
inputs:
5+
version:
6+
description: 'Optional. The WP-CLI version to install, e.g. 2.4.0. Defaults to the latest release.'
7+
required: false
8+
default: 'latest'
9+
10+
# Not installed with the setup-php `tools` input: that downloads WP-CLI in a single attempt
11+
# and only logs an error on failure, so the job breaks later with `wp: command not found`.
12+
# The phar is cached in 6 hour windows, so jobs keep getting new WP-CLI releases without each
13+
# downloading it. When a new window's download fails, the previous window's phar is used instead.
14+
runs:
15+
using: 'composite'
16+
steps:
17+
- name: Get the WP-CLI cache window
18+
id: get-wp-cli-window
19+
shell: bash
20+
run: echo "window=$(( $(/bin/date -u '+%s') / WP_CLI_CACHE_SECONDS ))" >> "$GITHUB_OUTPUT"
21+
env:
22+
WP_CLI_CACHE_SECONDS: 21600 # 6 hours.
23+
24+
- name: Cache WP-CLI
25+
id: cache-wp-cli
26+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
27+
with:
28+
path: ${{ runner.temp }}/wp-cli.phar
29+
key: ${{ runner.os }}-wp-cli-${{ inputs.version }}-${{ steps.get-wp-cli-window.outputs.window }}
30+
restore-keys: ${{ runner.os }}-wp-cli-${{ inputs.version }}-
31+
32+
- name: Install WP-CLI
33+
shell: bash
34+
run: |
35+
if [ "$CACHE_HIT" != 'true' ]; then
36+
if curl --fail --silent --show-error --location --retry 5 --retry-all-errors \
37+
--output "${RUNNER_TEMP}/wp-cli.phar.download" "$WP_CLI_URL"; then
38+
mv "${RUNNER_TEMP}/wp-cli.phar.download" "${RUNNER_TEMP}/wp-cli.phar"
39+
elif [ -f "${RUNNER_TEMP}/wp-cli.phar" ]; then
40+
echo "::warning::Could not download WP-CLI, using the previously cached version."
41+
else
42+
echo "::error::Could not download WP-CLI."
43+
exit 1
44+
fi
45+
fi
46+
sudo install -m 0755 "${RUNNER_TEMP}/wp-cli.phar" /usr/local/bin/wp
47+
wp --version
48+
env:
49+
CACHE_HIT: ${{ steps.cache-wp-cli.outputs.cache-hit }}
50+
WP_CLI_URL: ${{ inputs.version == 'latest' && 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar' || format('https://github.com/wp-cli/wp-cli/releases/download/v{0}/wp-cli-{0}.phar', inputs.version) }}

‎.github/pull_request_template.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Hi there! Thanks for contributing to WordPress!
33
44
Pull Requests in this GitHub repository **must** be linked to a ticket in the WordPress Core Trac instance (https://core.trac.wordpress.org), and are only used for code review. **No pull requests will be merged on GitHub.**
55
6-
See the WordPress Handbook page on using PRs for Code Review more information: https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/
6+
See the WordPress Handbook page on using PRs for Code Review for more information: https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/
7+
8+
Do not open pull requests for security vulnerabilities. Please follow the responsible disclosure policy instead: https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/
79
810
If this is your first time contributing, you may also find reviewing these guides first to be helpful:
911
- FAQs for New Contributors: https://make.wordpress.org/core/handbook/tutorials/faq-for-new-contributors/

‎.github/workflows/coding-standards.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ on:
6868
- 'composer.*'
6969
- '**.jshintrc'
7070
- 'phpcs.xml.dist'
71+
- '.github/actions/setup-npm/**'
7172
- '.github/workflows/coding-standards.yml'
7273
- '.github/workflows/reusable-coding-standards-*.yml'
7374
workflow_dispatch:
7475

7576
# Cancels all previous workflow runs for pull requests that have not completed.
7677
concurrency:
77-
# The concurrency group contains the workflow name and the branch name for pull requests
78+
# The concurrency group contains the workflow name and the pull request number for pull requests
7879
# or the commit hash for any other events.
79-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
80+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
8081
cancel-in-progress: true
8182

8283
# Disable permissions for all available scopes by default.

‎.github/workflows/end-to-end-tests.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ on:
4343
- 'tools/local-env/**'
4444
- 'tools/vendors/**'
4545
- 'tools/webpack/**'
46+
- '.github/actions/setup-npm/**'
47+
- '.github/actions/download-with-retry/**'
4648
- '.github/workflows/end-to-end-tests.yml'
4749
- '.github/workflows/reusable-end-to-end-tests*.yml'
4850
workflow_dispatch:
4951

5052
# Cancels all previous workflow runs for pull requests that have not completed.
5153
concurrency:
52-
# The concurrency group contains the workflow name and the branch name for pull requests
54+
# The concurrency group contains the workflow name and the pull request number for pull requests
5355
# or the commit hash for any other events.
54-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
56+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
5557
cancel-in-progress: true
5658

5759
# Disable permissions for all available scopes by default.
@@ -81,10 +83,13 @@ jobs:
8183
fail-fast: false
8284
matrix:
8385
LOCAL_SCRIPT_DEBUG: [ true, false ]
86+
# See the "Projects" section in tests/e2e/README.md.
87+
test-group: [ 'parallel', 'serial' ]
8488
# A matrix value is needed in the 'name' directive for proper grouping in the GitHub UI.
8589
label: [ 'E2E Tests' ]
8690
with:
8791
LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }}
92+
test-group: ${{ matrix.test-group }}
8893

8994
slack-notifications:
9095
name: Slack Notifications

0 commit comments

Comments
 (0)