Skip to content

Commit 2c9918f

Browse files
committed
Build/Test Tools: Restore automated testing in the 3.7 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 3.7 branch. See #50401. git-svn-id: https://develop.svn.wordpress.org/branches/3.7@50324 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 95f5d9b commit 2c9918f

10 files changed

Lines changed: 804 additions & 3 deletions

.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.6
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.6 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.6
5064

5165
# The debug settings to add to `wp-config.php`.
5266
LOCAL_WP_DEBUG=true
@@ -57,3 +71,10 @@ LOCAL_WP_ENVIRONMENT_TYPE=local
5771

5872
# The URL to use when running e2e tests.
5973
WP_BASE_URL=http://localhost:${LOCAL_PORT}
74+
75+
##
76+
# The revision number of the WordPress Importer plugin to use when running unit tests.
77+
#
78+
# This should be an SVN revision number from the official plugin repository on wordpress.org.
79+
##
80+
WP_IMPORTER_REVISION=2387243
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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.4'
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 PHPCS on all Core files
64+
run: phpcs -q -n --report=checkstyle | cs2pr
65+
66+
- name: Check test suite files for warnings
67+
run: phpcs tests -q --report=checkstyle | cs2pr
68+
69+
# Runs the JavaScript coding standards checks.
70+
#
71+
# JSHint violations are not currently reported inline with annotations.
72+
#
73+
# Performs the following steps:
74+
# - Checks out the repository.
75+
# - Logs debug information about the runner container.
76+
# - Installs NodeJS 14.
77+
# - Sets up caching for NPM.
78+
# - Logs updated debug information.
79+
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
80+
# - Run the WordPress JSHint checks.
81+
# - todo: Configure Slack notifications for failing tests.
82+
jshint:
83+
name: JavaScript coding standards
84+
runs-on: ubuntu-latest
85+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
86+
env:
87+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
88+
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v2
92+
93+
- name: Log debug information
94+
run: |
95+
npm --version
96+
node --version
97+
git --version
98+
svn --version
99+
100+
- name: Install NodeJS
101+
uses: actions/setup-node@v1
102+
with:
103+
node-version: 14
104+
105+
- name: Cache NodeJS modules
106+
uses: actions/cache@v2
107+
env:
108+
cache-name: cache-node-modules
109+
with:
110+
# npm cache files are stored in `~/.npm` on Linux/macOS
111+
path: ~/.npm
112+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
113+
restore-keys: |
114+
${{ runner.os }}-npm-
115+
116+
- name: Log debug information
117+
run: |
118+
npm --version
119+
node --version
120+
121+
- name: Install Dependencies
122+
run: npx install-changed --install-command="npm ci"
123+
124+
- name: Run JSHint
125+
run: npm run grunt jshint
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: End-to-end Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
# The end to end test suite was introduced in WordPress 5.3.
8+
- '5.[3-9]'
9+
- '[6-9].[0-9]'
10+
tags:
11+
- '5.[3-9]*'
12+
- '[6-9].[0-9]*'
13+
pull_request:
14+
15+
env:
16+
LOCAL_DIR: build
17+
18+
jobs:
19+
# Runs the end-to-end test suite.
20+
#
21+
# Performs the following steps:
22+
# - Cancels all previous workflow runs for pull requests that have not completed.
23+
# - Set environment variables.
24+
# - Checks out the repository.
25+
# - Logs debug information about the runner container.
26+
# - Installs NodeJS 14.
27+
# - Sets up caching for NPM.
28+
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
29+
# - Builds WordPress to run from the `build` directory.
30+
# - Starts the WordPress Docker container.
31+
# - Logs general debug information.
32+
# - Logs the running Docker containers.
33+
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
34+
# - Install WordPress within the Docker container.
35+
# - Run the E2E tests.
36+
# - todo: Configure Slack notifications for failing tests.
37+
e2e-tests:
38+
name: E2E Tests
39+
runs-on: ubuntu-latest
40+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
41+
42+
steps:
43+
- name: Cancel previous runs of this workflow (pull requests only)
44+
if: ${{ github.event_name == 'pull_request' }}
45+
uses: styfle/cancel-workflow-action@0.5.0
46+
with:
47+
access_token: ${{ github.token }}
48+
49+
- name: Configure environment variables
50+
run: |
51+
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
52+
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
53+
54+
- name: Checkout repository
55+
uses: actions/checkout@v2
56+
57+
- name: Log debug information
58+
run: |
59+
npm --version
60+
node --version
61+
curl --version
62+
git --version
63+
svn --version
64+
php --version
65+
php -i
66+
locale -a
67+
68+
- name: Install NodeJS
69+
uses: actions/setup-node@v1
70+
with:
71+
node-version: 14
72+
73+
- name: Cache NodeJS modules
74+
uses: actions/cache@v2
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') }}
81+
restore-keys: |
82+
${{ runner.os }}-npm-
83+
84+
- name: Install Dependencies
85+
run: npx install-changed --install-command="npm ci"
86+
87+
- name: Build WordPress
88+
run: npm run build
89+
90+
- name: Start Docker environment
91+
run: |
92+
npm run env:start
93+
94+
- name: General debug information
95+
run: |
96+
npm --version
97+
node --version
98+
curl --version
99+
git --version
100+
svn --version
101+
102+
- name: Log running Docker containers
103+
run: docker ps -a
104+
105+
- name: Docker debug information
106+
run: |
107+
docker -v
108+
docker-compose -v
109+
docker-compose run --rm mysql mysql --version
110+
docker-compose run --rm php php --version
111+
docker-compose run --rm php php -m
112+
docker-compose run --rm php php -i
113+
docker-compose run --rm php locale -a
114+
115+
- name: Install WordPress
116+
run: npm run env:install
117+
118+
- name: Run E2E tests
119+
run: npm run test:e2e
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

0 commit comments

Comments
 (0)