Skip to content

Commit 298a648

Browse files
committed
Build/Test Tools: Backport updates to GitHub Actions.
This backports several changesets to GitHub Actions workflows. These changesets: - address the deprecated notices related to save-output and set-output to ensure the workflows continue to run after these are removed. - adds support for automatically retrying a failed workflow once. - removes workflow files that are not applicable to the branch. - backports some Docker environment related tooling updates for the sake of consistency across branches. Merges [53736], [53737], [53940], [53947], [54039], [54096], [54108], [54293], [54313], [54342], [54343], [54373], [54511], [54649], [54650], [54651], [54674], [54750], [54852], [55152], [55487] to the 5.8 branch. See #55652, #56407, #56528, #54695, #56820, #56816, #56793, #56820, #57572. git-svn-id: https://develop.svn.wordpress.org/branches/5.8@55517 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 95c6438 commit 298a648

File tree

11 files changed

+276
-327
lines changed

11 files changed

+276
-327
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ LOCAL_DB_TYPE=mysql
5757
#
5858
# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
5959
#
60-
# When using `mysql`, see https://hub.docker.com/_/mysql/ for valid versions.
61-
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
60+
# When using `mysql`, see https://hub.docker.com/r/amd64/mysql for valid versions.
61+
# When using `mariadb`, see https://hub.docker.com/r/amd64/mariadb for valid versions.
6262
##
6363
LOCAL_DB_VERSION=5.7
6464

.github/workflows/coding-standards.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ on:
99
- '3.[89]'
1010
- '[4-9].[0-9]'
1111
tags:
12-
- '3.[89]*'
13-
- '[4-9].[0-9]*'
12+
- '[0-9]+.[0-9]'
13+
- '[0-9]+.[0-9].[0-9]+'
14+
- '!3.7.[0-9]+'
1415
pull_request:
1516
branches:
1617
- trunk
@@ -20,7 +21,7 @@ on:
2021
# Any change to a PHP or JavaScript file should run checks.
2122
- '**.js'
2223
- '**.php'
23-
# These files configure NPM. Changes could affect the outcome.
24+
# These files configure npm. Changes could affect the outcome.
2425
- 'package*.json'
2526
# These files configure Composer. Changes could affect the outcome.
2627
- 'composer.*'
@@ -63,10 +64,10 @@ jobs:
6364

6465
steps:
6566
- name: Checkout repository
66-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
67+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6768

6869
- name: Set up PHP
69-
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
70+
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
7071
with:
7172
php-version: '7.4'
7273
coverage: none
@@ -78,9 +79,9 @@ jobs:
7879
composer --version
7980
8081
- name: Install Composer dependencies
81-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
82+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
8283
with:
83-
composer-options: "--no-progress --no-ansi --no-interaction"
84+
composer-options: "--no-progress --no-ansi"
8485

8586
- name: Make Composer packages available globally
8687
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -104,10 +105,9 @@ jobs:
104105
# Performs the following steps:
105106
# - Checks out the repository.
106107
# - Logs debug information about the GitHub Action runner.
107-
# - Installs NodeJS.
108-
# - Sets up caching for NPM.
108+
# - Installs Node.js.
109109
# - Logs updated debug information.
110-
# _ Installs NPM dependencies.
110+
# _ Installs npm dependencies.
111111
# - Run the WordPress JSHint checks.
112112
# - Ensures version-controlled files are not modified or deleted.
113113
jshint:
@@ -120,7 +120,7 @@ jobs:
120120

121121
steps:
122122
- name: Checkout repository
123-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
123+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
124124

125125
- name: Log debug information
126126
run: |
@@ -129,8 +129,8 @@ jobs:
129129
git --version
130130
svn --version
131131
132-
- name: Install NodeJS
133-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
132+
- name: Install Node.js
133+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
134134
with:
135135
node-version-file: '.nvmrc'
136136
cache: npm
@@ -161,3 +161,34 @@ jobs:
161161
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
162162
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
163163
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
164+
165+
failed-workflow:
166+
name: Failed workflow tasks
167+
runs-on: ubuntu-latest
168+
needs: [ phpcs, jshint, slack-notifications ]
169+
if: |
170+
always() &&
171+
github.repository == 'WordPress/wordpress-develop' &&
172+
github.event_name != 'pull_request' &&
173+
github.run_attempt < 2 &&
174+
(
175+
needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' ||
176+
needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
177+
)
178+
179+
steps:
180+
- name: Dispatch workflow run
181+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
182+
with:
183+
retries: 2
184+
retry-exempt-status-codes: 418
185+
script: |
186+
github.rest.actions.createWorkflowDispatch({
187+
owner: context.repo.owner,
188+
repo: context.repo.repo,
189+
workflow_id: 'failed-workflow.yml',
190+
ref: 'trunk',
191+
inputs: {
192+
run_id: '${{ github.run_id }}'
193+
}
194+
});

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

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ on:
88
- '5.[3-9]'
99
- '[6-9].[0-9]'
1010
tags:
11-
- '5.[3-9]*'
12-
- '[6-9].[0-9]*'
11+
- '[0-9]+.[0-9]'
12+
- '[0-9]+.[0-9].[0-9]+'
13+
- '![34].[0-9].[0-9]+'
14+
- '!5.[0-2].[0-9]+'
1315
pull_request:
1416
branches:
1517
- trunk
@@ -34,9 +36,8 @@ jobs:
3436
# - Sets environment variables.
3537
# - Checks out the repository.
3638
# - Logs debug information about the GitHub Action runner.
37-
# - Installs NodeJS.
38-
# - Sets up caching for NPM.
39-
# _ Installs NPM dependencies.
39+
# - Installs Node.js.
40+
# _ Installs npm dependencies.
4041
# - Builds WordPress to run from the `build` directory.
4142
# - Starts the WordPress Docker container.
4243
# - Logs general debug information.
@@ -58,7 +59,7 @@ jobs:
5859
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
5960
6061
- name: Checkout repository
61-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
62+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6263

6364
- name: Log debug information
6465
run: |
@@ -71,8 +72,8 @@ jobs:
7172
php -i
7273
locale -a
7374
74-
- name: Install NodeJS
75-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
75+
- name: Install Node.js
76+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
7677
with:
7778
node-version-file: '.nvmrc'
7879
cache: npm
@@ -129,3 +130,33 @@ jobs:
129130
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
130131
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
131132
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
133+
134+
failed-workflow:
135+
name: Failed workflow tasks
136+
runs-on: ubuntu-latest
137+
needs: [ e2e-tests, slack-notifications ]
138+
if: |
139+
always() &&
140+
github.repository == 'WordPress/wordpress-develop' &&
141+
github.event_name != 'pull_request' &&
142+
github.run_attempt < 2 &&
143+
(
144+
needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
145+
)
146+
147+
steps:
148+
- name: Dispatch workflow run
149+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
150+
with:
151+
retries: 2
152+
retry-exempt-status-codes: 418
153+
script: |
154+
github.rest.actions.createWorkflowDispatch({
155+
owner: context.repo.owner,
156+
repo: context.repo.repo,
157+
workflow_id: 'failed-workflow.yml',
158+
ref: 'trunk',
159+
inputs: {
160+
run_id: '${{ github.run_id }}'
161+
}
162+
});

.github/workflows/javascript-tests.yml

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ on:
88
- '3.[89]'
99
- '[4-9].[0-9]'
1010
tags:
11-
- '3.[89]*'
12-
- '[4-9].[0-9]*'
11+
- '[0-9]+.[0-9]'
12+
- '[0-9]+.[0-9].[0-9]+'
13+
- '!3.7.[0-9]+'
1314
pull_request:
1415
branches:
1516
- trunk
@@ -18,7 +19,7 @@ on:
1819
paths:
1920
# Any change to a JavaScript file should run tests.
2021
- '**.js'
21-
# These files configure NPM. Changes could affect the outcome.
22+
# These files configure npm. Changes could affect the outcome.
2223
- 'package*.json'
2324
# This file configures ESLint. Changes could affect the outcome.
2425
- '.eslintignore'
@@ -43,10 +44,9 @@ jobs:
4344
# Performs the following steps:
4445
# - Checks out the repository.
4546
# - Logs debug information about the GitHub Action runner.
46-
# - Installs NodeJS.
47-
# - Sets up caching for NPM.
47+
# - Installs Node.js.
4848
# - Logs updated debug information.
49-
# _ Installs NPM dependencies.
49+
# _ Installs npm dependencies.
5050
# - Run the WordPress QUnit tests.
5151
# - Ensures version-controlled files are not modified or deleted.
5252
test-js:
@@ -57,7 +57,7 @@ jobs:
5757

5858
steps:
5959
- name: Checkout repository
60-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
60+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6161

6262
- name: Log debug information
6363
run: |
@@ -66,8 +66,8 @@ jobs:
6666
git --version
6767
svn --version
6868
69-
- name: Install NodeJS
70-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
69+
- name: Install Node.js
70+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
7171
with:
7272
node-version-file: '.nvmrc'
7373
cache: npm
@@ -98,3 +98,33 @@ jobs:
9898
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
9999
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
100100
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
101+
102+
failed-workflow:
103+
name: Failed workflow tasks
104+
runs-on: ubuntu-latest
105+
needs: [ test-js, slack-notifications ]
106+
if: |
107+
always() &&
108+
github.repository == 'WordPress/wordpress-develop' &&
109+
github.event_name != 'pull_request' &&
110+
github.run_attempt < 2 &&
111+
(
112+
needs.test-js.result == 'cancelled' || needs.test-js.result == 'failure'
113+
)
114+
115+
steps:
116+
- name: Dispatch workflow run
117+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
118+
with:
119+
retries: 2
120+
retry-exempt-status-codes: 418
121+
script: |
122+
github.rest.actions.createWorkflowDispatch({
123+
owner: context.repo.owner,
124+
repo: context.repo.repo,
125+
workflow_id: 'failed-workflow.yml',
126+
ref: 'trunk',
127+
inputs: {
128+
run_id: '${{ github.run_id }}'
129+
}
130+
});

.github/workflows/php-compatibility.yml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ on:
88
- '5.[5-9]'
99
- '[6-9].[0-9]'
1010
tags:
11-
- '5.[5-9]*'
12-
- '[6-9].[0-9]*'
11+
- '[0-9]+.[0-9]'
12+
- '[0-9]+.[0-9].[0-9]+'
13+
- '![34].[0-9].[0-9]+'
14+
- '!5.[0-4].[0-9]+'
1315
pull_request:
1416
branches:
1517
- trunk
@@ -57,10 +59,10 @@ jobs:
5759

5860
steps:
5961
- name: Checkout repository
60-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
62+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6163

6264
- name: Set up PHP
63-
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
65+
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
6466
with:
6567
php-version: '7.4'
6668
coverage: none
@@ -71,10 +73,22 @@ jobs:
7173
php --version
7274
composer --version
7375
76+
# This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
77+
# http://man7.org/linux/man-pages/man1/date.1.html
78+
- name: "Get last Monday's date"
79+
id: get-date
80+
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
81+
82+
- name: Cache PHP compatibility scan cache
83+
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
84+
with:
85+
path: .cache/phpcompat.json
86+
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
87+
7488
- name: Install Composer dependencies
75-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
89+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
7690
with:
77-
composer-options: "--no-progress --no-ansi --no-interaction"
91+
composer-options: "--no-progress --no-ansi"
7892

7993
- name: Make Composer packages available globally
8094
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -100,3 +114,33 @@ jobs:
100114
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
101115
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
102116
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
117+
118+
failed-workflow:
119+
name: Failed workflow tasks
120+
runs-on: ubuntu-latest
121+
needs: [ php-compatibility, slack-notifications ]
122+
if: |
123+
always() &&
124+
github.repository == 'WordPress/wordpress-develop' &&
125+
github.event_name != 'pull_request' &&
126+
github.run_attempt < 2 &&
127+
(
128+
needs.php-compatibility.result == 'cancelled' || needs.php-compatibility.result == 'failure'
129+
)
130+
131+
steps:
132+
- name: Dispatch workflow run
133+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
134+
with:
135+
retries: 2
136+
retry-exempt-status-codes: 418
137+
script: |
138+
github.rest.actions.createWorkflowDispatch({
139+
owner: context.repo.owner,
140+
repo: context.repo.repo,
141+
workflow_id: 'failed-workflow.yml',
142+
ref: 'trunk',
143+
inputs: {
144+
run_id: '${{ github.run_id }}'
145+
}
146+
});

0 commit comments

Comments
 (0)