Skip to content

Commit e2e1419

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], [54650], [54651], [54674], [54750], [54852], [55152], [54651], [55487] to the 5.1 branch. See #55652, #56407, #56528, #54695, #56820, #56816, #56793, #56820, #57572. git-svn-id: https://develop.svn.wordpress.org/branches/5.1@55524 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8b11d58 commit e2e1419

File tree

8 files changed

+185
-113
lines changed

8 files changed

+185
-113
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: 43 additions & 11 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.*'
@@ -60,10 +61,10 @@ jobs:
6061

6162
steps:
6263
- name: Checkout repository
63-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
64+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6465

6566
- name: Set up PHP
66-
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
67+
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
6768
with:
6869
php-version: '7.2'
6970
coverage: none
@@ -75,9 +76,9 @@ jobs:
7576
composer --version
7677
7778
- name: Install Composer dependencies
78-
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
79+
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
7980
with:
80-
composer-options: "--no-progress --no-ansi --no-interaction"
81+
composer-options: "--no-progress --no-ansi"
8182

8283
- name: Make Composer packages available globally
8384
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
@@ -97,7 +98,7 @@ jobs:
9798
# - Logs debug information about the GitHub Action runner.
9899
# - Installs NodeJS.
99100
# - Logs updated debug information.
100-
# _ Installs NPM dependencies.
101+
# _ Installs npm dependencies.
101102
# - Run the WordPress JSHint checks.
102103
jshint:
103104
name: JavaScript coding standards
@@ -109,7 +110,7 @@ jobs:
109110

110111
steps:
111112
- name: Checkout repository
112-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
113+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
113114

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

.github/workflows/javascript-tests.yml

Lines changed: 38 additions & 7 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'
@@ -45,7 +46,7 @@ jobs:
4546
# - Logs debug information about the GitHub Action runner.
4647
# - Installs NodeJS.
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/phpunit-tests.yml

Lines changed: 45 additions & 15 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
@@ -30,7 +30,7 @@ env:
3030
LOCAL_DIR: build
3131
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
3232
COMPOSER_INSTALL: ${{ false }}
33-
# Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
33+
# Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
3434
PHPUNIT_SCRIPT: php
3535
LOCAL_PHP_MEMCACHED: ${{ false }}
3636
SLOW_TESTS: 'external-http,media,restapi'
@@ -43,7 +43,7 @@ jobs:
4343
# - Checks out the repository.
4444
# - Logs debug information about the GitHub Action runner.
4545
# - Installs NodeJS.
46-
# _ Installs NPM dependencies.
46+
# _ Installs npm dependencies.
4747
# - Builds WordPress to run from the `build` directory.
4848
# - Creates a ZIP file of compiled WordPress.
4949
# - Uploads ZIP file as an artifact.
@@ -54,7 +54,7 @@ jobs:
5454

5555
steps:
5656
- name: Checkout repository
57-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
57+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
5858

5959
- name: Log debug information
6060
run: |
@@ -69,8 +69,8 @@ jobs:
6969
php -i
7070
locale -a
7171
72-
- name: Install NodeJS
73-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
72+
- name: Set up Node.js
73+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
7474
with:
7575
node-version-file: '.nvmrc'
7676
cache: npm
@@ -82,13 +82,13 @@ jobs:
8282
run: npm run build
8383

8484
- name: Create ZIP artifact
85-
uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 # v0.6.2
85+
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464 # v0.7.1
8686
with:
8787
filename: built-wp-${{ github.sha }}.zip
8888
exclusions: '*.git* /*node_modules/* packagehash.txt'
8989

9090
- name: Upload build artifact
91-
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
91+
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
9292
with:
9393
name: built-wp-${{ github.sha }}
9494
path: built-wp-${{ github.sha }}.zip
@@ -102,7 +102,7 @@ jobs:
102102
# - Downloads the built WordPress artifact from the previous job.
103103
# - Unzips the artifact.
104104
# - Installs NodeJS.
105-
# _ Installs NPM dependencies.
105+
# _ Installs npm dependencies.
106106
# - Configures caching for Composer.
107107
# _ Installs Composer dependencies (if desired).
108108
# - Logs Docker debug information (about the Docker installation within the runner).
@@ -220,15 +220,15 @@ jobs:
220220
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
221221
222222
- name: Download the built WordPress artifact
223-
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0
223+
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
224224
with:
225225
name: built-wp-${{ github.sha }}
226226

227227
- name: Unzip built artifact
228228
run: unzip built-wp-${{ github.sha }}.zip
229229

230-
- name: Install NodeJS
231-
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
230+
- name: Set up Node.js
231+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
232232
with:
233233
node-version-file: '.nvmrc'
234234
cache: npm
@@ -238,7 +238,7 @@ jobs:
238238

239239
- name: Cache Composer dependencies
240240
if: ${{ env.COMPOSER_INSTALL == true }}
241-
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
241+
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
242242
env:
243243
cache-name: cache-composer-dependencies
244244
with:
@@ -319,7 +319,7 @@ jobs:
319319

320320
- name: Checkout the WordPress Test Reporter
321321
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
322-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
322+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
323323
with:
324324
repository: 'WordPress/phpunit-test-runner'
325325
path: 'test-runner'
@@ -350,3 +350,33 @@ jobs:
350350
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
351351
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
352352
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
353+
354+
failed-workflow:
355+
name: Failed workflow tasks
356+
runs-on: ubuntu-latest
357+
needs: [ test-php, slack-notifications ]
358+
if: |
359+
always() &&
360+
github.repository == 'WordPress/wordpress-develop' &&
361+
github.event_name != 'pull_request' &&
362+
github.run_attempt < 2 &&
363+
(
364+
needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
365+
)
366+
367+
steps:
368+
- name: Dispatch workflow run
369+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
370+
with:
371+
retries: 2
372+
retry-exempt-status-codes: 418
373+
script: |
374+
github.rest.actions.createWorkflowDispatch({
375+
owner: context.repo.owner,
376+
repo: context.repo.repo,
377+
workflow_id: 'failed-workflow.yml',
378+
ref: 'trunk',
379+
inputs: {
380+
run_id: '${{ github.run_id }}'
381+
}
382+
});

0 commit comments

Comments
 (0)