Skip to content

Commit f019ba5

Browse files
committed
Build/Test Tools: Use the Slack notifications workflow as a reusable one.
This backports several changesets that are required to remove the reliance on the `workflow_run` event for posting Slack notifications. The Slack notification workflow will now be called as a reusable one, which has several benefits (see [53591]). Several other minor GitHub Actions related updates are also being backported in this commit to maintain tooling consistency across branches that still receive security updates as a courtesy when necessary. Workflows that are not relevant to this branch that were mistakenly backported are also being deleted. Merges [50473], [50704], [50796], [50930], [51341], [51355], [51498], [51511], [51535], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.3 branch. See #56095. git-svn-id: https://develop.svn.wordpress.org/branches/5.3@53602 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e0ad050 commit f019ba5

File tree

8 files changed

+138
-406
lines changed

8 files changed

+138
-406
lines changed

.github/workflows/coding-standards.yml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
# PHPCS checking was introduced in WordPress 5.1.
66
push:
77
branches:
8-
- master
98
- trunk
109
- '3.[89]'
1110
- '[4-9].[0-9]'
@@ -14,7 +13,6 @@ on:
1413
- '[4-9].[0-9]*'
1514
pull_request:
1615
branches:
17-
- master
1816
- trunk
1917
- '3.[89]'
2018
- '[4-9].[0-9]'
@@ -34,6 +32,13 @@ on:
3432
- '.github/workflows/*.yml'
3533
workflow_dispatch:
3634

35+
# Cancels all previous workflow runs for pull requests that have not completed.
36+
concurrency:
37+
# The concurrency group contains the workflow name and the branch name for pull requests
38+
# or the commit hash for any other events.
39+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
40+
cancel-in-progress: true
41+
3742
jobs:
3843
# Runs PHP coding standards checks.
3944
#
@@ -48,18 +53,18 @@ jobs:
4853
# - Logs PHP_CodeSniffer debug information.
4954
# - Runs PHPCS on the full codebase with warnings suppressed.
5055
# - Runs PHPCS on the `tests` directory without warnings suppressed.
51-
# - todo: Configure Slack notifications for failing scans.
5256
phpcs:
5357
name: PHP coding standards
5458
runs-on: ubuntu-latest
59+
timeout-minutes: 20
5560
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
5661

5762
steps:
5863
- name: Checkout repository
59-
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
64+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
6065

6166
- name: Set up PHP
62-
uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0
67+
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
6368
with:
6469
php-version: '7.3'
6570
coverage: none
@@ -71,7 +76,7 @@ jobs:
7176
composer --version
7277
7378
- name: Install Composer dependencies
74-
uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0
79+
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
7580
with:
7681
composer-options: "--no-progress --no-ansi --no-interaction"
7782

@@ -96,23 +101,22 @@ jobs:
96101
#
97102
# Performs the following steps:
98103
# - Checks out the repository.
99-
# - Logs debug information about the runner container.
100-
# - Installs NodeJS 14.
101-
# - Sets up caching for NPM.
104+
# - Logs debug information about the GitHub Action runner.
105+
# - Installs NodeJS.
102106
# - Logs updated debug information.
103-
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
107+
# _ Installs NPM dependencies.
104108
# - Run the WordPress JSHint checks.
105-
# - todo: Configure Slack notifications for failing tests.
106109
jshint:
107110
name: JavaScript coding standards
108111
runs-on: ubuntu-latest
112+
timeout-minutes: 20
109113
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
110114
env:
111115
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
112116

113117
steps:
114118
- name: Checkout repository
115-
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
119+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
116120

117121
- name: Log debug information
118122
run: |
@@ -122,18 +126,10 @@ jobs:
122126
svn --version
123127
124128
- name: Install NodeJS
125-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
126-
with:
127-
node-version: 14
128-
129-
- name: Cache NodeJS modules
130-
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
131-
env:
132-
cache-name: cache-node-modules
129+
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
133130
with:
134-
# npm cache files are stored in `~/.npm` on Linux/macOS
135-
path: ~/.npm
136-
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
131+
node-version-file: '.nvmrc'
132+
cache: npm
137133

138134
- name: Log debug information
139135
run: |
@@ -145,3 +141,16 @@ jobs:
145141

146142
- name: Run JSHint
147143
run: npm run grunt jshint
144+
145+
slack-notifications:
146+
name: Slack Notifications
147+
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
148+
needs: [ phpcs, jshint ]
149+
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
150+
with:
151+
calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
152+
secrets:
153+
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
154+
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
155+
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
156+
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}

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

Lines changed: 0 additions & 119 deletions
This file was deleted.

.github/workflows/javascript-tests.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
# JavaScript testing was introduced in WordPress 3.8.
55
push:
66
branches:
7-
- master
87
- trunk
98
- '3.[89]'
109
- '[4-9].[0-9]'
@@ -13,7 +12,6 @@ on:
1312
- '[4-9].[0-9]*'
1413
pull_request:
1514
branches:
16-
- master
1715
- trunk
1816
- '3.[89]'
1917
- '[4-9].[0-9]'
@@ -32,31 +30,32 @@ on:
3230
- '.github/workflows/*.yml'
3331
workflow_dispatch:
3432

33+
# Cancels all previous workflow runs for pull requests that have not completed.
34+
concurrency:
35+
# The concurrency group contains the workflow name and the branch name for pull requests
36+
# or the commit hash for any other events.
37+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
38+
cancel-in-progress: true
39+
3540
jobs:
3641
# Runs the QUnit tests for WordPress.
3742
#
3843
# Performs the following steps:
39-
# - Cancels all previous workflow runs for pull requests that have not completed.
4044
# - Checks out the repository.
41-
# - Logs debug information about the runner container.
42-
# - Installs NodeJS 14.
43-
# - Sets up caching for NPM.
45+
# - Logs debug information about the GitHub Action runner.
46+
# - Installs NodeJS.
4447
# - Logs updated debug information.
45-
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
48+
# _ Installs NPM dependencies.
4649
# - Run the WordPress QUnit tests.
47-
# - todo: Configure Slack notifications for failing tests.
4850
test-js:
4951
name: QUnit Tests
5052
runs-on: ubuntu-latest
53+
timeout-minutes: 20
5154
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
5255

5356
steps:
54-
- name: Cancel previous runs of this workflow (pull requests only)
55-
if: ${{ github.event_name == 'pull_request' }}
56-
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
57-
5857
- name: Checkout repository
59-
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
58+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
6059

6160
- name: Log debug information
6261
run: |
@@ -66,18 +65,10 @@ jobs:
6665
svn --version
6766
6867
- name: Install NodeJS
69-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
68+
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
7069
with:
71-
node-version: 14
72-
73-
- name: Cache NodeJS modules
74-
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
75-
env:
76-
cache-name: cache-node-modules
77-
with:
78-
# npm cache files are stored in `~/.npm` on Linux/macOS
79-
path: ~/.npm
80-
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
70+
node-version-file: '.nvmrc'
71+
cache: npm
8172

8273
- name: Log debug information
8374
run: |
@@ -89,3 +80,16 @@ jobs:
8980

9081
- name: Run QUnit tests
9182
run: npm run grunt qunit:compiled
83+
84+
slack-notifications:
85+
name: Slack Notifications
86+
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
87+
needs: [ test-js ]
88+
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
89+
with:
90+
calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
91+
secrets:
92+
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
93+
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
94+
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
95+
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}

0 commit comments

Comments
 (0)