Skip to content

Commit d38a681

Browse files
committed
Build/Test Tools: Backport GitHub Action and build improvements to the 4.7 branch.
This backports several build and test tool improvements to the 4.7 branch. Most notably, this includes: - The changes required to allow each workflow to be triggered by the `workflow_dispatch` event so that tests can be run on a schedule [50590]. - Splitting single site and multisite tests into parallel jobs [50379]. - Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444]. - Better branch and path scoping for GitHub Action workflows when running on `pull_request` [50432,50479]. - Several `devDependency` updates. Merges [50379,50387,50413,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.7 branch. See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@50636 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d8d5de6 commit d38a681

File tree

10 files changed

+761
-294
lines changed

10 files changed

+761
-294
lines changed

.github/workflows/coding-standards.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
11
name: Coding Standards
22

33
on:
4+
# JSHint was introduced in WordPress 3.8.
5+
# PHPCS checking was introduced in WordPress 5.1.
46
push:
57
branches:
68
- master
7-
# JSHint was introduced in WordPress 3.8.
8-
# PHPCS checking was introduced in WordPress 5.1.
9+
- trunk
910
- '3.[89]'
1011
- '[4-9].[0-9]'
1112
tags:
1213
- '3.[89]*'
1314
- '[4-9].[0-9]*'
1415
pull_request:
16+
branches:
17+
- master
18+
- trunk
19+
- '3.[89]'
20+
- '[4-9].[0-9]'
21+
paths:
22+
# Any change to a PHP or JavaScript file should run checks.
23+
- '**.js'
24+
- '**.php'
25+
# These files configure NPM. Changes could affect the outcome.
26+
- 'package*.json'
27+
# These files configure Composer. Changes could affect the outcome.
28+
- 'composer.*'
29+
# This file configures JSHint. Changes could affect the outcome.
30+
- '.jshintrc'
31+
# This file configures PHPCS. Changes could affect the outcome.
32+
- 'phpcs.xml.dist'
33+
# Changes to workflow files should always verify all workflows are successful.
34+
- '.github/workflows/*.yml'
35+
workflow_dispatch:
1536

1637
jobs:
1738
# Runs the JavaScript coding standards checks.
@@ -36,7 +57,7 @@ jobs:
3657

3758
steps:
3859
- name: Checkout repository
39-
uses: actions/checkout@v2
60+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
4061

4162
- name: Log debug information
4263
run: |
@@ -46,28 +67,26 @@ jobs:
4667
svn --version
4768
4869
- name: Install NodeJS
49-
uses: actions/setup-node@v1
70+
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
5071
with:
5172
node-version: 14
5273

5374
- name: Cache NodeJS modules
54-
uses: actions/cache@v2
75+
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
5576
env:
5677
cache-name: cache-node-modules
5778
with:
5879
# npm cache files are stored in `~/.npm` on Linux/macOS
5980
path: ~/.npm
6081
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
61-
restore-keys: |
62-
${{ runner.os }}-npm-
6382

6483
- name: Log debug information
6584
run: |
6685
npm --version
6786
node --version
6887
6988
- name: Install Dependencies
70-
run: npx install-changed --install-command="npm ci"
89+
run: npm ci
7190

7291
- name: Run JSHint
7392
run: npm run grunt jshint

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
name: End-to-end Tests
22

33
on:
4+
# The end to end test suite was introduced in WordPress 5.3.
45
push:
56
branches:
67
- master
7-
# The end to end test suite was introduced in WordPress 5.3.
8+
- trunk
89
- '5.[3-9]'
910
- '[6-9].[0-9]'
1011
tags:
1112
- '5.[3-9]*'
1213
- '[6-9].[0-9]*'
1314
pull_request:
15+
branches:
16+
- master
17+
- trunk
18+
- '5.[3-9]'
19+
- '[6-9].[0-9]'
20+
workflow_dispatch:
1421

1522
env:
1623
LOCAL_DIR: build
@@ -42,17 +49,15 @@ jobs:
4249
steps:
4350
- name: Cancel previous runs of this workflow (pull requests only)
4451
if: ${{ github.event_name == 'pull_request' }}
45-
uses: styfle/[email protected]
46-
with:
47-
access_token: ${{ github.token }}
52+
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
4853

4954
- name: Configure environment variables
5055
run: |
5156
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
5257
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
5358
5459
- name: Checkout repository
55-
uses: actions/checkout@v2
60+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
5661

5762
- name: Log debug information
5863
run: |
@@ -66,23 +71,21 @@ jobs:
6671
locale -a
6772
6873
- name: Install NodeJS
69-
uses: actions/setup-node@v1
74+
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
7075
with:
7176
node-version: 14
7277

7378
- name: Cache NodeJS modules
74-
uses: actions/cache@v2
79+
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
7580
env:
7681
cache-name: cache-node-modules
7782
with:
7883
# npm cache files are stored in `~/.npm` on Linux/macOS
7984
path: ~/.npm
8085
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
81-
restore-keys: |
82-
${{ runner.os }}-npm-
8386

8487
- name: Install Dependencies
85-
run: npx install-changed --install-command="npm ci"
88+
run: npm ci
8689

8790
- name: Build WordPress
8891
run: npm run build

.github/workflows/javascript-tests.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
name: JavaScript Tests
22

33
on:
4+
# JavaScript testing was introduced in WordPress 3.8.
45
push:
56
branches:
67
- master
7-
# JavaScript testing was introduced in WordPress 3.8.
8+
- trunk
89
- '3.[89]'
910
- '[4-9].[0-9]'
1011
tags:
1112
- '3.[89]*'
1213
- '[4-9].[0-9]*'
1314
pull_request:
15+
branches:
16+
- master
17+
- trunk
18+
- '3.[89]'
19+
- '[4-9].[0-9]'
20+
paths:
21+
# Any change to a JavaScript file should run tests.
22+
- '**.js'
23+
# These files configure NPM. Changes could affect the outcome.
24+
- 'package*.json'
25+
# This file configures ESLint. Changes could affect the outcome.
26+
- '.eslintignore'
27+
# This file configures JSHint. Changes could affect the outcome.
28+
- '.jshintrc'
29+
# Any change to the QUnit directory should run tests.
30+
- 'tests/qunit/**'
31+
# Changes to workflow files should always verify all workflows are successful.
32+
- '.github/workflows/*.yml'
33+
workflow_dispatch:
1434

1535
jobs:
1636
# Runs the QUnit tests for WordPress.
@@ -33,12 +53,10 @@ jobs:
3353
steps:
3454
- name: Cancel previous runs of this workflow (pull requests only)
3555
if: ${{ github.event_name == 'pull_request' }}
36-
uses: styfle/[email protected]
37-
with:
38-
access_token: ${{ github.token }}
56+
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
3957

4058
- name: Checkout repository
41-
uses: actions/checkout@v2
59+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
4260

4361
- name: Log debug information
4462
run: |
@@ -48,28 +66,26 @@ jobs:
4866
svn --version
4967
5068
- name: Install NodeJS
51-
uses: actions/setup-node@v1
69+
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
5270
with:
5371
node-version: 14
5472

5573
- name: Cache NodeJS modules
56-
uses: actions/cache@v2
74+
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
5775
env:
5876
cache-name: cache-node-modules
5977
with:
6078
# npm cache files are stored in `~/.npm` on Linux/macOS
6179
path: ~/.npm
6280
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
63-
restore-keys: |
64-
${{ runner.os }}-npm-
6581

6682
- name: Log debug information
6783
run: |
6884
npm --version
6985
node --version
7086
7187
- name: Install Dependencies
72-
run: npx install-changed --install-command="npm ci"
88+
run: npm ci
7389

7490
- name: Run QUnit tests
7591
run: npm run grunt qunit:compiled

.github/workflows/php-compatibility.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
name: PHP Compatibility
22

33
on:
4+
# PHP compatibility testing was introduced in WordPress 5.5.
45
push:
56
branches:
67
- master
7-
# The PHP compatibility testing was introduced in WordPress 5.5.
8+
- trunk
89
- '5.[5-9]'
910
- '[6-9].[0-9]'
1011
tags:
1112
- '5.[5-9]*'
1213
- '[6-9].[0-9]*'
1314
pull_request:
15+
branches:
16+
- master
17+
- trunk
18+
- '5.[5-9]'
19+
- '[6-9].[0-9]'
20+
paths:
21+
# This workflow only scans PHP files.
22+
- '**.php'
23+
# These files configure Composer. Changes could affect the outcome.
24+
- 'composer.*'
25+
# This file configures PHP Compatibility scanning. Changes could affect the outcome.
26+
- 'phpcompat.xml.dist'
27+
# Changes to workflow files should always verify all workflows are successful.
28+
- '.github/workflows/*.yml'
29+
workflow_dispatch:
1430

1531
jobs:
1632

@@ -34,10 +50,10 @@ jobs:
3450

3551
steps:
3652
- name: Checkout repository
37-
uses: actions/checkout@v2
53+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
3854

3955
- name: Set up PHP
40-
uses: shivammathur/setup-php@v2
56+
uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0
4157
with:
4258
php-version: '7.4'
4359
coverage: none
@@ -49,7 +65,7 @@ jobs:
4965
composer --version
5066
5167
- name: Install Composer dependencies
52-
uses: ramsey/composer-install@v1
68+
uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0
5369
with:
5470
composer-options: "--no-progress --no-ansi --no-interaction"
5571

0 commit comments

Comments
 (0)