Skip to content

Commit ac58b56

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.5 branch. See #55652, #56407, #56528, #54695, #56820, #56816, #56793, #56820, #57572. git-svn-id: https://develop.svn.wordpress.org/branches/5.5@55520 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4424e88 commit ac58b56

File tree

9 files changed

+226
-122
lines changed

9 files changed

+226
-122
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 & 12 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.*'
@@ -61,10 +62,10 @@ jobs:
6162

6263
steps:
6364
- name: Checkout repository
64-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
65+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6566

6667
- name: Set up PHP
67-
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
68+
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
6869
with:
6970
php-version: '7.4'
7071
coverage: none
@@ -76,9 +77,9 @@ jobs:
7677
composer --version
7778
7879
- name: Install Composer dependencies
79-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
80+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
8081
with:
81-
composer-options: "--no-progress --no-ansi --no-interaction"
82+
composer-options: "--no-progress --no-ansi"
8283

8384
- name: Make Composer packages available globally
8485
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -99,9 +100,9 @@ jobs:
99100
# Performs the following steps:
100101
# - Checks out the repository.
101102
# - Logs debug information about the GitHub Action runner.
102-
# - Installs NodeJS.
103+
# - Installs Node.js.
103104
# - Logs updated debug information.
104-
# _ Installs NPM dependencies.
105+
# _ Installs npm dependencies.
105106
# - Run the WordPress JSHint checks.
106107
jshint:
107108
name: JavaScript coding standards
@@ -113,7 +114,7 @@ jobs:
113114

114115
steps:
115116
- name: Checkout repository
116-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
117+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
117118

118119
- name: Log debug information
119120
run: |
@@ -122,8 +123,8 @@ jobs:
122123
git --version
123124
svn --version
124125
125-
- name: Install NodeJS
126-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
126+
- name: Install Node.js
127+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
127128
with:
128129
node-version-file: '.nvmrc'
129130
cache: npm
@@ -151,3 +152,34 @@ jobs:
151152
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
152153
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
153154
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
155+
156+
failed-workflow:
157+
name: Failed workflow tasks
158+
runs-on: ubuntu-latest
159+
needs: [ phpcs, jshint, slack-notifications ]
160+
if: |
161+
always() &&
162+
github.repository == 'WordPress/wordpress-develop' &&
163+
github.event_name != 'pull_request' &&
164+
github.run_attempt < 2 &&
165+
(
166+
needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' ||
167+
needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
168+
)
169+
170+
steps:
171+
- name: Dispatch workflow run
172+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
173+
with:
174+
retries: 2
175+
retry-exempt-status-codes: 418
176+
script: |
177+
github.rest.actions.createWorkflowDispatch({
178+
owner: context.repo.owner,
179+
repo: context.repo.repo,
180+
workflow_id: 'failed-workflow.yml',
181+
ref: 'trunk',
182+
inputs: {
183+
run_id: '${{ github.run_id }}'
184+
}
185+
});

.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
test-js:
5152
name: QUnit Tests
@@ -55,7 +56,7 @@ jobs:
5556

5657
steps:
5758
- name: Checkout repository
58-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
59+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
5960

6061
- name: Log debug information
6162
run: |
@@ -64,8 +65,8 @@ jobs:
6465
git --version
6566
svn --version
6667
67-
- name: Install NodeJS
68-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
68+
- name: Set up Node.js
69+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
6970
with:
7071
node-version-file: '.nvmrc'
7172
cache: npm
@@ -93,3 +94,33 @@ jobs:
9394
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
9495
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
9596
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
97+
98+
failed-workflow:
99+
name: Failed workflow tasks
100+
runs-on: ubuntu-latest
101+
needs: [ test-js, slack-notifications ]
102+
if: |
103+
always() &&
104+
github.repository == 'WordPress/wordpress-develop' &&
105+
github.event_name != 'pull_request' &&
106+
github.run_attempt < 2 &&
107+
(
108+
needs.test-js.result == 'cancelled' || needs.test-js.result == 'failure'
109+
)
110+
111+
steps:
112+
- name: Dispatch workflow run
113+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
114+
with:
115+
retries: 2
116+
retry-exempt-status-codes: 418
117+
script: |
118+
github.rest.actions.createWorkflowDispatch({
119+
owner: context.repo.owner,
120+
repo: context.repo.repo,
121+
workflow_id: 'failed-workflow.yml',
122+
ref: 'trunk',
123+
inputs: {
124+
run_id: '${{ github.run_id }}'
125+
}
126+
});

.github/workflows/php-compatibility.yml

Lines changed: 38 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
@@ -55,10 +57,10 @@ jobs:
5557

5658
steps:
5759
- name: Checkout repository
58-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
60+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
5961

6062
- name: Set up PHP
61-
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
63+
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
6264
with:
6365
php-version: '7.4'
6466
coverage: none
@@ -70,9 +72,9 @@ jobs:
7072
composer --version
7173
7274
- name: Install Composer dependencies
73-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
75+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
7476
with:
75-
composer-options: "--no-progress --no-ansi --no-interaction"
77+
composer-options: "--no-progress --no-ansi"
7678

7779
- name: Make Composer packages available globally
7880
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -95,3 +97,33 @@ jobs:
9597
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
9698
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
9799
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
100+
101+
failed-workflow:
102+
name: Failed workflow tasks
103+
runs-on: ubuntu-latest
104+
needs: [ php-compatibility, slack-notifications ]
105+
if: |
106+
always() &&
107+
github.repository == 'WordPress/wordpress-develop' &&
108+
github.event_name != 'pull_request' &&
109+
github.run_attempt < 2 &&
110+
(
111+
needs.php-compatibility.result == 'cancelled' || needs.php-compatibility.result == 'failure'
112+
)
113+
114+
steps:
115+
- name: Dispatch workflow run
116+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
117+
with:
118+
retries: 2
119+
retry-exempt-status-codes: 418
120+
script: |
121+
github.rest.actions.createWorkflowDispatch({
122+
owner: context.repo.owner,
123+
repo: context.repo.repo,
124+
workflow_id: 'failed-workflow.yml',
125+
ref: 'trunk',
126+
inputs: {
127+
run_id: '${{ github.run_id }}'
128+
}
129+
});

.github/workflows/phpunit-tests.yml

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
- '3.[7-9]'
88
- '[4-9].[0-9]'
99
tags:
10-
- '3.[7-9]*'
11-
- '[4-9].[0-9]*'
10+
- '[0-9]+.[0-9]'
11+
- '[0-9]+.[0-9].[0-9]+'
1212
pull_request:
1313
branches:
1414
- trunk
@@ -28,7 +28,7 @@ concurrency:
2828

2929
env:
3030
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
31-
# Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
31+
# Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
3232
PHPUNIT_SCRIPT: php
3333
LOCAL_PHP_MEMCACHED: ${{ false }}
3434
SLOW_TESTS: 'external-http,media,restapi'
@@ -39,8 +39,8 @@ jobs:
3939
# Performs the following steps:
4040
# - Sets environment variables.
4141
# - Sets up the environment variables needed for testing with memcached (if desired).
42-
# - Installs NodeJS.
43-
# - Installs NPM dependencies
42+
# - Installs Node.js.
43+
# - Installs npm dependencies
4444
# - Configures caching for Composer.
4545
# - Installs Composer dependencies.
4646
# - Logs Docker debug information (about the Docker installation within the runner).
@@ -107,27 +107,27 @@ jobs:
107107
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
108108
109109
- name: Checkout repository
110-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
110+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
111111

112-
- name: Install NodeJS
113-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
112+
- name: Install Node.js
113+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
114114
with:
115115
node-version-file: '.nvmrc'
116116
cache: npm
117117

118-
- name: Install Dependencies
118+
- name: Install npm dependencies
119119
run: npm ci
120120

121-
- name: Get composer cache directory
121+
- name: Get Composer cache directory
122122
id: composer-cache
123-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
123+
run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
124124

125125
- name: Cache Composer dependencies
126-
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
126+
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
127127
env:
128128
cache-name: cache-composer-dependencies
129129
with:
130-
path: ${{ steps.composer-cache.outputs.dir }}
130+
path: ${{ steps.composer-cache.outputs.composer_dir }}
131131
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
132132

133133
- name: Install Composer dependencies
@@ -215,7 +215,7 @@ jobs:
215215

216216
- name: Checkout the WordPress Test Reporter
217217
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
218-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
218+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
219219
with:
220220
repository: 'WordPress/phpunit-test-runner'
221221
path: 'test-runner'
@@ -238,3 +238,33 @@ jobs:
238238
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
239239
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
240240
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
241+
242+
failed-workflow:
243+
name: Failed workflow tasks
244+
runs-on: ubuntu-latest
245+
needs: [ test-php, slack-notifications ]
246+
if: |
247+
always() &&
248+
github.repository == 'WordPress/wordpress-develop' &&
249+
github.event_name != 'pull_request' &&
250+
github.run_attempt < 2 &&
251+
(
252+
needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
253+
)
254+
255+
steps:
256+
- name: Dispatch workflow run
257+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
258+
with:
259+
retries: 2
260+
retry-exempt-status-codes: 418
261+
script: |
262+
github.rest.actions.createWorkflowDispatch({
263+
owner: context.repo.owner,
264+
repo: context.repo.repo,
265+
workflow_id: 'failed-workflow.yml',
266+
ref: 'trunk',
267+
inputs: {
268+
run_id: '${{ github.run_id }}'
269+
}
270+
});

0 commit comments

Comments
 (0)