Skip to content

Commit 44d543f

Browse files
committed
Build/Test Tools: Restore automated testing in the 4.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 4.7 branch. See #50401. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@50310 602fd350-edb4-49c9-b593-d223f7449a82
1 parent de15f2f commit 44d543f

File tree

10 files changed

+791
-3
lines changed

10 files changed

+791
-3
lines changed

.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
@@ -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: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 the JavaScript coding standards checks.
18+
#
19+
# JSHint violations are not currently reported inline with annotations.
20+
#
21+
# Performs the following steps:
22+
# - Checks out the repository.
23+
# - Logs debug information about the runner container.
24+
# - Installs NodeJS 14.
25+
# - Sets up caching for NPM.
26+
# - Logs updated debug information.
27+
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
28+
# - Run the WordPress JSHint checks.
29+
# - todo: Configure Slack notifications for failing tests.
30+
jshint:
31+
name: JavaScript coding standards
32+
runs-on: ubuntu-latest
33+
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
34+
env:
35+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v2
40+
41+
- name: Log debug information
42+
run: |
43+
npm --version
44+
node --version
45+
git --version
46+
svn --version
47+
48+
- name: Install NodeJS
49+
uses: actions/setup-node@v1
50+
with:
51+
node-version: 14
52+
53+
- name: Cache NodeJS modules
54+
uses: actions/cache@v2
55+
env:
56+
cache-name: cache-node-modules
57+
with:
58+
# npm cache files are stored in `~/.npm` on Linux/macOS
59+
path: ~/.npm
60+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
61+
restore-keys: |
62+
${{ runner.os }}-npm-
63+
64+
- name: Log debug information
65+
run: |
66+
npm --version
67+
node --version
68+
69+
- name: Install Dependencies
70+
run: npx install-changed --install-command="npm ci"
71+
72+
- name: Run JSHint
73+
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/[email protected]
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/[email protected]
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)