Skip to content

Commit ff21b71

Browse files
committed
Merge branch 'trunk' into 62221-hardening
# Conflicts: # .github/workflows/reusable-performance.yml
2 parents 150c8c2 + 7fe8f1c commit ff21b71

File tree

166 files changed

+9030
-5097
lines changed

Some content is hidden

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

166 files changed

+9030
-5097
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ LOCAL_DB_TYPE=mysql
5151
# When using `mysql`, see https://hub.docker.com/_/mysql for valid versions.
5252
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
5353
##
54-
LOCAL_DB_VERSION=8.0
54+
LOCAL_DB_VERSION=8.4
5555

5656
# Whether or not to enable multisite.
5757
LOCAL_MULTISITE=false
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Cleanup Pull Requests
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
- '4.[1-9]'
8+
- '[5-9].[0-9]'
9+
10+
# Cancels all previous workflow runs for pull requests that have not completed.
11+
concurrency:
12+
# The concurrency group contains the workflow name and the branch name for pull requests
13+
# or the commit hash for any other events.
14+
group: ${{ github.workflow }}-${{ github.sha }}
15+
cancel-in-progress: true
16+
17+
# Disable permissions for all available scopes by default.
18+
# Any needed permissions should be configured at the job level.
19+
permissions: {}
20+
21+
jobs:
22+
# Runs pull request cleanup.
23+
close-prs:
24+
name: Clean up pull requests
25+
permissions:
26+
pull-requests: write
27+
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
28+
uses: ./.github/workflows/reusable-cleanup-pull-requests.yml

.github/workflows/install-testing.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,25 @@ jobs:
7878

7979
# Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers.
8080
exclude:
81+
# There are no local WordPress Docker environment containers for PHP <= 5.3.
8182
- php: '5.2'
8283
- php: '5.3'
84+
# MySQL containers <= 5.5 do not exist or fail to start properly.
8385
- db-version: '5.0'
8486
- db-version: '5.1'
8587
- db-version: '5.5'
88+
# The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
8689
- php: '7.2'
8790
db-version: '8.4'
8891
- php: '7.3'
8992
db-version: '8.4'
93+
# Only test the latest innovation release.
94+
- db-version: '9.0'
95+
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
9096
- php: '7.2'
91-
db-version: '9.0'
97+
db-version: '9.1'
9298
- php: '7.3'
93-
db-version: '9.0'
99+
db-version: '9.1'
94100

95101
services:
96102
database:

.github/workflows/local-docker-environment.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,15 @@ jobs:
8888
db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}
8989

9090
exclude:
91-
# The MySQL 5.5 containers will not start.
91+
# MySQL containers <= 5.5 do not exist or fail to start properly.
9292
- db-version: '5.5'
93-
# MySQL 9.0+ will not work on PHP 7.2 & 7.3
93+
# Only test the latest innovation release.
94+
- db-version: '9.0'
95+
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
9496
- php: '7.2'
95-
db-version: '9.0'
97+
db-version: '9.1'
9698
- php: '7.3'
97-
db-version: '9.0'
99+
db-version: '9.1'
98100

99101
with:
100102
os: ${{ matrix.os }}

.github/workflows/performance.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ permissions: {}
3232
jobs:
3333
# Runs the performance test suite.
3434
performance:
35-
name: Performance tests ${{ matrix.memcached && '(with memcached)' || '' }}
35+
name: ${{ matrix.multisite && 'Multisite' || 'Single site' }}
3636
uses: WordPress/wordpress-develop/.github/workflows/reusable-performance.yml@trunk
3737
permissions:
3838
contents: read
39-
if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }}
39+
if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
4040
strategy:
4141
fail-fast: false
4242
matrix:
4343
memcached: [ true, false ]
44+
multisite: [ true, false ]
4445
with:
4546
memcached: ${{ matrix.memcached }}
47+
multisite: ${{ matrix.multisite }}
4648
secrets:
4749
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}
4850

.github/workflows/phpunit-tests.yml

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
os: [ ubuntu-latest ]
4848
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
4949
db-type: [ 'mysql' ]
50-
db-version: [ '5.7', '8.0', '8.4', '9.0' ]
50+
db-version: [ '5.7', '8.0', '8.4' ]
5151
tests-domain: [ 'example.org' ]
5252
multisite: [ false, true ]
5353
memcached: [ false ]
@@ -91,14 +91,6 @@ jobs:
9191
multisite: false
9292
memcached: false
9393
report: true
94-
95-
exclude:
96-
# MySQL 9.0+ will not work on PHP 7.2 & 7.3
97-
- php: '7.2'
98-
db-version: '9.0'
99-
- php: '7.3'
100-
db-version: '9.0'
101-
10294
with:
10395
os: ${{ matrix.os }}
10496
php: ${{ matrix.php }}
@@ -126,7 +118,7 @@ jobs:
126118
os: [ ubuntu-latest ]
127119
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
128120
db-type: [ 'mariadb' ]
129-
db-version: [ '10.4', '10.6', '10.11', '11.2' ]
121+
db-version: [ '5.5', '10.3', '10.4', '10.5', '10.6', '10.11', '11.4' ]
130122
multisite: [ false, true ]
131123
memcached: [ false ]
132124

@@ -135,13 +127,13 @@ jobs:
135127
- os: ubuntu-latest
136128
php: '8.3'
137129
db-type: 'mariadb'
138-
db-version: '11.2'
130+
db-version: '11.4'
139131
multisite: false
140132
memcached: true
141133
- os: ubuntu-latest
142134
php: '8.3'
143135
db-type: 'mariadb'
144-
db-version: '11.2'
136+
db-version: '11.4'
145137
multisite: true
146138
memcached: true
147139
with:
@@ -154,13 +146,85 @@ jobs:
154146
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
155147
report: ${{ matrix.report || false }}
156148

149+
#
150+
# Creates PHPUnit test jobs to test MariaDB and MySQL innovation releases.
151+
#
152+
# Though innovation releases are deemed "production grade" and never receive LTS status, they include new features
153+
# and updates that will be included in the next LTS version.
154+
#
155+
# Because upstream support for innovation releases gets dropped when a new one is released, only the most recent
156+
# innovation version is tested.
157+
#
158+
test-innovation-releases:
159+
name: PHP ${{ matrix.php }}
160+
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk
161+
permissions:
162+
contents: read
163+
secrets: inherit
164+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
165+
strategy:
166+
fail-fast: false
167+
matrix:
168+
os: [ ubuntu-latest ]
169+
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
170+
db-type: [ 'mysql', 'mariadb' ]
171+
db-version: [ '9.1', '11.6' ]
172+
multisite: [ false, true ]
173+
memcached: [ false ]
174+
db-innovation: [ true ]
175+
176+
exclude:
177+
# MySQL 9.0+ will not work on PHP <= 7.3 because mysql_native_password was removed. See https://core.trac.wordpress.org/ticket/61218.
178+
- php: '7.2'
179+
db-version: '9.1'
180+
- php: '7.3'
181+
db-version: '9.1'
182+
# Exclude version combinations that don't exist.
183+
- db-type: 'mariadb'
184+
db-version: '9.1'
185+
- db-type: 'mysql'
186+
db-version: '11.6'
187+
with:
188+
os: ${{ matrix.os }}
189+
php: ${{ matrix.php }}
190+
db-type: ${{ matrix.db-type }}
191+
db-version: ${{ matrix.db-version }}
192+
db-innovation: ${{ matrix.db-innovation }}
193+
multisite: ${{ matrix.multisite }}
194+
memcached: ${{ matrix.memcached }}
195+
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
196+
report: ${{ matrix.report || false }}
197+
198+
#
199+
# Runs specific individual test groups.
200+
#
201+
specific-test-groups:
202+
name: ${{ matrix.phpunit-test-groups }}
203+
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk
204+
permissions:
205+
contents: read
206+
secrets: inherit
207+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
208+
strategy:
209+
fail-fast: false
210+
matrix:
211+
php: [ '7.2', '7.4', '8.0', '8.4' ]
212+
db-type: [ 'mysql' ]
213+
db-version: [ '8.4' ]
214+
phpunit-test-groups: [ 'html-api-html5lib-tests' ]
215+
with:
216+
php: ${{ matrix.php }}
217+
db-type: ${{ matrix.db-type }}
218+
db-version: ${{ matrix.db-version }}
219+
phpunit-test-groups: ${{ matrix.phpunit-test-groups }}
220+
157221
slack-notifications:
158222
name: Slack Notifications
159223
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
160224
permissions:
161225
actions: read
162226
contents: read
163-
needs: [ test-with-mysql, test-with-mariadb ]
227+
needs: [ test-with-mysql, test-with-mariadb, test-innovation-releases, specific-test-groups ]
164228
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
165229
with:
166230
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
##
2+
# A reusable workflow that finds and closes any pull requests that are linked to Trac
3+
# tickets that are referenced as fixed in commit messages.
4+
#
5+
# More info about using GitHub pull requests for contributing to WordPress can be found in the handbook: https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/.
6+
##
7+
name: Run pull request cleanup
8+
9+
on:
10+
workflow_call:
11+
12+
jobs:
13+
# Finds and closes pull requests referencing fixed Trac tickets in commit messages using the
14+
# documented expected format
15+
#
16+
# Commit message format is documented in the Core handbook: https://make.wordpress.org/core/handbook/best-practices/commit-messages/.
17+
#
18+
# Performs the following steps:
19+
# - Parse fixed ticket numbers from the commit message.
20+
# - Parse the SVN revision from the commit message.
21+
# - Searches for pull requests referencing any fixed tickets.
22+
# - Leaves a comment on each PR before closing.
23+
close-prs:
24+
name: Find and close PRs
25+
runs-on: ubuntu-latest
26+
permissions:
27+
pull-requests: write
28+
29+
steps:
30+
- name: Find fixed ticket numbers
31+
id: trac-tickets
32+
run: |
33+
COMMIT_MESSAGE=$(cat <<'EOF' | sed -n '/^Fixes #/,/\./p'
34+
${{ github.event.head_commit.message }}
35+
EOF
36+
)
37+
echo "fixed_list=$(echo \"$COMMIT_MESSAGE\" | sed -n 's/.*Fixes #\([0-9]\+\).*/\1/p' | tr '\n' ' ')" >> $GITHUB_OUTPUT
38+
39+
- name: Get the SVN revision
40+
id: git-svn-id
41+
run: |
42+
COMMIT_MESSAGE=$(cat <<'EOF' | sed -n '$p'
43+
${{ github.event.head_commit.message }}
44+
EOF
45+
)
46+
echo "svn_revision_number=$(echo \"$COMMIT_MESSAGE\" | sed -n 's/.*git-svn-id: https:\/\/develop.svn.wordpress.org\/[^@]*@\([0-9]*\) .*/\1/p')" >> $GITHUB_OUTPUT
47+
48+
- name: Find pull requests
49+
id: linked-prs
50+
if: ${{ steps.trac-tickets.outputs.fixed_list != '' && steps.git-svn-id.outputs.svn_revision_number != '' }}
51+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
52+
with:
53+
script: |
54+
const fixedList = "${{ steps.trac-tickets.outputs.fixed_list }}".split(' ').filter(Boolean);
55+
56+
let prNumbers = [];
57+
58+
for (const ticket of fixedList) {
59+
const query = 'is:pr is:open repo:' + context.repo.owner + '/' + context.repo.repo + ' in:body https://core.trac.wordpress.org/ticket/' + ticket;
60+
const result = await github.rest.search.issuesAndPullRequests({ q: query });
61+
62+
prNumbers = prNumbers.concat(result.data.items.map(pr => pr.number));
63+
}
64+
65+
return prNumbers;
66+
67+
- name: Comment and close pull requests
68+
if: ${{ steps.trac-tickets.outputs.fixed_list != '' && steps.git-svn-id.outputs.svn_revision_number != '' }}
69+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
70+
with:
71+
script: |
72+
const prNumbers = ${{ steps.linked-prs.outputs.result }};
73+
74+
const commentBody = `A commit was made that fixes the Trac ticket referenced in the description of this pull request.
75+
76+
SVN changeset: [${{ steps.git-svn-id.outputs.svn_revision_number }}](https://core.trac.wordpress.org/changeset/${{ steps.git-svn-id.outputs.svn_revision_number }})
77+
GitHub commit: https://github.com/WordPress/wordpress-develop/commit/${{ github.sha }}
78+
79+
This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.`;
80+
81+
// Update all matched pull requests.
82+
for (const prNumber of prNumbers) {
83+
// Comment on the pull request with details.
84+
await github.rest.issues.createComment({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
issue_number: prNumber,
88+
body: commentBody
89+
});
90+
91+
// Close the pull request.
92+
await github.rest.pulls.update({
93+
owner: context.repo.owner,
94+
repo: context.repo.repo,
95+
pull_number: prNumber,
96+
state: 'closed'
97+
});
98+
}

.github/workflows/reusable-javascript-tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ name: JavaScript tests
55

66
on:
77
workflow_call:
8+
inputs:
9+
disable-apparmor:
10+
description: 'Whether to disable AppArmor.'
11+
required: false
12+
type: 'boolean'
13+
default: false
814

915
# Disable permissions for all available scopes by default.
1016
# Any needed permissions should be configured at the job level.
@@ -49,6 +55,15 @@ jobs:
4955
- name: Install npm Dependencies
5056
run: npm ci
5157

58+
# Older branches using outdated versions of Puppeteer fail on newer versions of the `ubuntu-24` image.
59+
# This disables AppArmor in order to work around those failures.
60+
#
61+
# See https://issues.chromium.org/issues/373753919
62+
# and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
63+
- name: Disable AppArmor
64+
if: ${{ inputs.disable-apparmor }}
65+
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
66+
5267
- name: Run QUnit tests
5368
run: npm run grunt qunit:compiled
5469

0 commit comments

Comments
 (0)