Skip to content

Commit d43ceec

Browse files
committed
Build/Test Tools: Restore automated testing in the 5.4 branch.
This commit merges the workflow files required to run automated testing on GitHub Actions. In addition, [49836] and [50285] have been included in order to keep the local Docker environment consistent across all branches. Merges [49162,49168-49169,49175,49204,49227-49228,49244,49369,49371,49548,49781-49784,49786,49836,49938,50268,50285,50298] to the 5.4 branch. See #50401. git-svn-id: https://develop.svn.wordpress.org/branches/5.4@50303 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 74adc1b commit d43ceec

9 files changed

Lines changed: 709 additions & 3 deletions

File tree

.env

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,22 @@ LOCAL_PHP_XDEBUG=false
4545
# Whether or not to enable Memcached.
4646
LOCAL_PHP_MEMCACHED=false
4747

48-
# The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions.
49-
LOCAL_MYSQL=5.7
48+
##
49+
# The database software to use.
50+
#
51+
# Supported values are `mysql` and `mariadb`.
52+
##
53+
LOCAL_DB_TYPE=mysql
54+
55+
##
56+
# The database version to use.
57+
#
58+
# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
59+
#
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.
62+
##
63+
LOCAL_DB_VERSION=5.7
5064

5165
# The debug settings to add to `wp-config.php`.
5266
LOCAL_WP_DEBUG=true
@@ -56,3 +70,10 @@ LOCAL_SCRIPT_DEBUG=true
5670

5771
# The URL to use when running e2e tests.
5872
WP_BASE_URL=http://localhost:${LOCAL_PORT}
73+
74+
##
75+
# The revision number of the WordPress Importer plugin to use when running unit tests.
76+
#
77+
# This should be an SVN revision number from the official plugin repository on wordpress.org.
78+
##
79+
WP_IMPORTER_REVISION=2387243
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Coding Standards
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
# JSHint was introduced in WordPress 3.8.
8+
# PHPCS checking was introduced in WordPress 5.1.
9+
- '3.[89]'
10+
- '[4-9].[0-9]'
11+
tags:
12+
- '3.[89]*'
13+
- '[4-9].[0-9]*'
14+
pull_request:
15+
16+
jobs:
17+
# Runs PHP coding standards checks.
18+
#
19+
# Violations are reported inline with annotations.
20+
#
21+
# Performs the following steps:
22+
# - Checks out the repository.
23+
# - Sets up PHP.
24+
# - Logs debug information.
25+
# - Installs Composer dependencies (use cache if possible).
26+
# - Make Composer packages available globally.
27+
# - Logs PHP_CodeSniffer debug information.
28+
# - Runs PHPCS on the full codebase with warnings suppressed.
29+
# - Runs PHPCS on the `tests` directory without warnings suppressed.
30+
# - todo: Configure Slack notifications for failing scans.
31+
phpcs:
32+
name: PHP coding standards
33+
runs-on: ubuntu-latest
34+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
- name: Set up PHP
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: '7.3'
44+
coverage: none
45+
tools: composer, cs2pr
46+
47+
- name: Log debug information
48+
run: |
49+
php --version
50+
composer --version
51+
52+
- name: Install Composer dependencies
53+
uses: ramsey/composer-install@v1
54+
with:
55+
composer-options: "--no-progress --no-ansi --no-interaction"
56+
57+
- name: Make Composer packages available globally
58+
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
59+
60+
- name: Log PHPCS debug information
61+
run: phpcs -i
62+
63+
- name: Run PHPCBF on all Core files
64+
run: phpcbf
65+
66+
- name: Run PHPCS on all Core files
67+
run: phpcs -q -n --report=checkstyle | cs2pr
68+
69+
- name: Check test suite files for warnings
70+
run: phpcs tests -q --report=checkstyle | cs2pr
71+
72+
# Runs the JavaScript coding standards checks.
73+
#
74+
# JSHint violations are not currently reported inline with annotations.
75+
#
76+
# Performs the following steps:
77+
# - Checks out the repository.
78+
# - Logs debug information about the runner container.
79+
# - Installs NodeJS 14.
80+
# - Sets up caching for NPM.
81+
# - Logs updated debug information.
82+
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
83+
# - Run the WordPress JSHint checks.
84+
# - todo: Configure Slack notifications for failing tests.
85+
jshint:
86+
name: JavaScript coding standards
87+
runs-on: ubuntu-latest
88+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
89+
env:
90+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
91+
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v2
95+
96+
- name: Log debug information
97+
run: |
98+
npm --version
99+
node --version
100+
git --version
101+
svn --version
102+
103+
- name: Install NodeJS
104+
uses: actions/setup-node@v1
105+
with:
106+
node-version: 14
107+
108+
- name: Cache NodeJS modules
109+
uses: actions/cache@v2
110+
env:
111+
cache-name: cache-node-modules
112+
with:
113+
# npm cache files are stored in `~/.npm` on Linux/macOS
114+
path: ~/.npm
115+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
116+
restore-keys: |
117+
${{ runner.os }}-npm-
118+
119+
- name: Log debug information
120+
run: |
121+
npm --version
122+
node --version
123+
124+
- name: Install Dependencies
125+
run: npx install-changed --install-command="npm ci"
126+
127+
- name: Run JSHint
128+
run: npm run grunt jshint
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: JavaScript Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
# JavaScript testing was introduced in WordPress 3.8.
8+
- '3.[89]'
9+
- '[4-9].[0-9]'
10+
tags:
11+
- '3.[89]*'
12+
- '[4-9].[0-9]*'
13+
pull_request:
14+
15+
jobs:
16+
# Runs the QUnit tests for WordPress.
17+
#
18+
# Performs the following steps:
19+
# - Cancels all previous workflow runs for pull requests that have not completed.
20+
# - Checks out the repository.
21+
# - Logs debug information about the runner container.
22+
# - Installs NodeJS 14.
23+
# - Sets up caching for NPM.
24+
# - Logs updated debug information.
25+
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
26+
# - Run the WordPress QUnit tests.
27+
# - todo: Configure Slack notifications for failing tests.
28+
test-js:
29+
name: QUnit Tests
30+
runs-on: ubuntu-latest
31+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
32+
33+
steps:
34+
- name: Cancel previous runs of this workflow (pull requests only)
35+
if: ${{ github.event_name == 'pull_request' }}
36+
uses: styfle/cancel-workflow-action@0.5.0
37+
with:
38+
access_token: ${{ github.token }}
39+
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
- name: Log debug information
44+
run: |
45+
npm --version
46+
node --version
47+
git --version
48+
svn --version
49+
50+
- name: Install NodeJS
51+
uses: actions/setup-node@v1
52+
with:
53+
node-version: 14
54+
55+
- name: Cache NodeJS modules
56+
uses: actions/cache@v2
57+
env:
58+
cache-name: cache-node-modules
59+
with:
60+
# npm cache files are stored in `~/.npm` on Linux/macOS
61+
path: ~/.npm
62+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
63+
restore-keys: |
64+
${{ runner.os }}-npm-
65+
66+
- name: Log debug information
67+
run: |
68+
npm --version
69+
node --version
70+
71+
- name: Install Dependencies
72+
run: npx install-changed --install-command="npm ci"
73+
74+
- name: Run QUnit tests
75+
run: npm run grunt qunit:compiled
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: PHP Compatibility
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
# The PHP compatibility testing was introduced in WordPress 5.5.
8+
- '5.[5-9]'
9+
- '[6-9].[0-9]'
10+
tags:
11+
- '5.[5-9]*'
12+
- '[6-9].[0-9]*'
13+
pull_request:
14+
15+
jobs:
16+
17+
# Runs PHP compatibility testing.
18+
#
19+
# Violations are reported inline with annotations.
20+
#
21+
# Performs the following steps:
22+
# - Checks out the repository.
23+
# - Sets up PHP.
24+
# - Logs debug information about the runner container.
25+
# - Installs Composer dependencies (use cache if possible).
26+
# - Make Composer packages available globally.
27+
# - Logs PHP_CodeSniffer debug information.
28+
# - Runs the PHP compatibility tests.
29+
# - todo: Configure Slack notifications for failing scans.
30+
php-comatibility:
31+
name: Check PHP compatibility
32+
runs-on: ubuntu-latest
33+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v2
38+
39+
- name: Set up PHP
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: '7.4'
43+
coverage: none
44+
tools: composer, cs2pr
45+
46+
- name: Log debug information
47+
run: |
48+
php --version
49+
composer --version
50+
51+
- name: Install Composer dependencies
52+
uses: ramsey/composer-install@v1
53+
with:
54+
composer-options: "--no-progress --no-ansi --no-interaction"
55+
56+
- name: Make Composer packages available globally
57+
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
58+
59+
- name: Log PHPCS debug information
60+
run: phpcs -i
61+
62+
- name: Run PHP compatibility tests
63+
run: phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr

0 commit comments

Comments
 (0)