Skip to content

Commit 2b10ea0

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. Merges [53736], [53737], [53940], [53947], [54039], [54108], [54293], [54313], [54342], [54343], [54373], [54511], [54649], [54650], [54651], [54674], [54750], [54852], [55152], [55487] to the 5.9 branch. See #55652, #56407, #54695, #56820, #56816, #56793, #56820, #57572. git-svn-id: https://develop.svn.wordpress.org/branches/5.9@55516 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5c9b321 commit 2b10ea0

File tree

10 files changed

+265
-529
lines changed

10 files changed

+265
-529
lines changed

.github/workflows/coding-standards.yml

Lines changed: 46 additions & 14 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
@@ -81,18 +82,18 @@ jobs:
8182
# http://man7.org/linux/man-pages/man1/date.1.html
8283
- name: "Get last Monday's date"
8384
id: get-date
84-
run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")"
85+
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
8586

8687
- name: Cache PHPCS scan cache
87-
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
88+
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
8889
with:
8990
path: .cache/phpcs.json
9091
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
9192

9293
- name: Install Composer dependencies
93-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
94+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
9495
with:
95-
composer-options: "--no-progress --no-ansi --no-interaction"
96+
composer-options: "--no-progress --no-ansi"
9697

9798
- name: Make Composer packages available globally
9899
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -116,9 +117,9 @@ jobs:
116117
# Performs the following steps:
117118
# - Checks out the repository.
118119
# - Logs debug information about the GitHub Action runner.
119-
# - Installs NodeJS.
120+
# - Installs Node.js.
120121
# - Logs updated debug information.
121-
# _ Installs NPM dependencies.
122+
# _ Installs npm dependencies.
122123
# - Run the WordPress JSHint checks.
123124
# - Ensures version-controlled files are not modified or deleted.
124125
jshint:
@@ -131,7 +132,7 @@ jobs:
131132

132133
steps:
133134
- name: Checkout repository
134-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
135+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
135136

136137
- name: Log debug information
137138
run: |
@@ -140,8 +141,8 @@ jobs:
140141
git --version
141142
svn --version
142143
143-
- name: Install NodeJS
144-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
144+
- name: Install Node.js
145+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
145146
with:
146147
node-version-file: '.nvmrc'
147148
cache: npm
@@ -172,3 +173,34 @@ jobs:
172173
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
173174
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
174175
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
176+
177+
failed-workflow:
178+
name: Failed workflow tasks
179+
runs-on: ubuntu-latest
180+
needs: [ phpcs, jshint, slack-notifications ]
181+
if: |
182+
always() &&
183+
github.repository == 'WordPress/wordpress-develop' &&
184+
github.event_name != 'pull_request' &&
185+
github.run_attempt < 2 &&
186+
(
187+
needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' ||
188+
needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
189+
)
190+
191+
steps:
192+
- name: Dispatch workflow run
193+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
194+
with:
195+
retries: 2
196+
retry-exempt-status-codes: 418
197+
script: |
198+
github.rest.actions.createWorkflowDispatch({
199+
owner: context.repo.owner,
200+
repo: context.repo.repo,
201+
workflow_id: 'failed-workflow.yml',
202+
ref: 'trunk',
203+
inputs: {
204+
run_id: '${{ github.run_id }}'
205+
}
206+
});

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

Lines changed: 39 additions & 7 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,8 +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-
# _ Installs NPM dependencies.
39+
# - Installs Node.js.
40+
# _ Installs npm dependencies.
3941
# - Builds WordPress to run from the `build` directory.
4042
# - Starts the WordPress Docker container.
4143
# - Logs general debug information.
@@ -57,7 +59,7 @@ jobs:
5759
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
5860
5961
- name: Checkout repository
60-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
62+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6163

6264
- name: Log debug information
6365
run: |
@@ -70,8 +72,8 @@ jobs:
7072
php -i
7173
locale -a
7274
73-
- name: Install NodeJS
74-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
75+
- name: Install Node.js
76+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
7577
with:
7678
node-version-file: '.nvmrc'
7779
cache: npm
@@ -128,3 +130,33 @@ jobs:
128130
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
129131
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
130132
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 & 8 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,9 +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+
# - Installs Node.js.
4748
# - Logs updated debug information.
48-
# _ Installs NPM dependencies.
49+
# _ Installs npm dependencies.
4950
# - Run the WordPress QUnit tests.
5051
# - Ensures version-controlled files are not modified or deleted.
5152
test-js:
@@ -56,7 +57,7 @@ jobs:
5657

5758
steps:
5859
- name: Checkout repository
59-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
60+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6061

6162
- name: Log debug information
6263
run: |
@@ -65,8 +66,8 @@ jobs:
6566
git --version
6667
svn --version
6768
68-
- name: Install NodeJS
69-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
69+
- name: Install Node.js
70+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
7071
with:
7172
node-version-file: '.nvmrc'
7273
cache: npm
@@ -97,3 +98,33 @@ jobs:
9798
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
9899
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
99100
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: 40 additions & 8 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
@@ -75,18 +77,18 @@ jobs:
7577
# http://man7.org/linux/man-pages/man1/date.1.html
7678
- name: "Get last Monday's date"
7779
id: get-date
78-
run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")"
80+
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
7981

8082
- name: Cache PHP compatibility scan cache
81-
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
83+
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
8284
with:
8385
path: .cache/phpcompat.json
8486
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
8587

8688
- name: Install Composer dependencies
87-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
89+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
8890
with:
89-
composer-options: "--no-progress --no-ansi --no-interaction"
91+
composer-options: "--no-progress --no-ansi"
9092

9193
- name: Make Composer packages available globally
9294
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -112,3 +114,33 @@ jobs:
112114
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
113115
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
114116
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)