Skip to content

Commit 74c3d39

Browse files
noisysocksyouknowriad
authored andcommitted
Improve Travis CI build times (#13103)
1 parent 232012c commit 74c3d39

File tree

2 files changed

+46
-21
lines changed

2 files changed

+46
-21
lines changed

.travis.yml

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dist: trusty
22

3-
language: php
3+
language: generic
44

55
services:
66
- docker
@@ -13,56 +13,83 @@ notifications:
1313
cache:
1414
directories:
1515
- $HOME/.composer/cache
16-
- $HOME/.phpbrew
16+
- $HOME/.jest-cache
1717
- $HOME/.npm
18-
19-
before_install:
20-
- nvm install && nvm use
21-
- npm install npm -g
18+
- $HOME/.nvm/.cache
19+
- $HOME/.phpbrew
2220

2321
branches:
2422
only:
2523
- master
2624

25+
before_install:
26+
- nvm install
27+
2728
jobs:
2829
include:
29-
- stage: test
30+
- name: JS unit tests
3031
env: WP_VERSION=latest
32+
before_install:
33+
- nvm install --latest-npm
34+
install:
35+
- npm ci
3136
script:
32-
- npm install || exit 1
33-
- npm run ci || exit 1
37+
- npm run lint
38+
- npm run check-local-changes
39+
- npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
3440

35-
- stage: test
41+
- name: PHP unit tests (Docker)
3642
env: WP_VERSION=latest DOCKER=true
3743
script:
3844
- ./bin/run-wp-unit-tests.sh
3945

40-
- stage: test
46+
- name: PHP unit tests (PHP 5.6)
47+
language: php
4148
php: 5.6
4249
env: WP_VERSION=latest
4350
script:
4451
- ./bin/run-wp-unit-tests.sh
4552
if: branch = master and type != "pull_request"
4653

47-
- stage: test
48-
php: 7.1
54+
- name: PHP unit tests (PHP 5.3)
4955
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
5056
script:
5157
- ./bin/run-wp-unit-tests.sh
5258
if: branch = master and type != "pull_request"
5359

54-
- stage: test
55-
php: 7.1
60+
- name: PHP unit tests (PHP 5.2)
5661
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
5762
script:
5863
- ./bin/run-wp-unit-tests.sh
5964

60-
- stage: test
65+
- name: E2E tests (Admin with plugins) (1/2)
6166
env: WP_VERSION=latest POPULAR_PLUGINS=true
67+
install:
68+
- ./bin/setup-local-env.sh
69+
script:
70+
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
71+
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests )
72+
73+
- name: E2E tests (Admin with plugins) (2/2)
74+
env: WP_VERSION=latest POPULAR_PLUGINS=true
75+
install:
76+
- ./bin/setup-local-env.sh
77+
script:
78+
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
79+
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )
80+
81+
- name: E2E tests (Author without plugins) (1/2)
82+
env: WP_VERSION=latest E2E_ROLE=author
83+
install:
84+
- ./bin/setup-local-env.sh
6285
script:
63-
- ./bin/run-e2e-tests.sh || exit 1
86+
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
87+
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests )
6488

65-
- stage: test
89+
- name: E2E tests (Author without plugins) (2/2)
6690
env: WP_VERSION=latest E2E_ROLE=author
91+
install:
92+
- ./bin/setup-local-env.sh
6793
script:
68-
- ./bin/run-e2e-tests.sh || exit 1
94+
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
95+
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
"check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2\" \"wp-scripts check-licenses --dev\"",
153153
"precheck-local-changes": "npm run docs:build",
154154
"check-local-changes": "( git diff -U0 | xargs -0 node bin/process-git-diff ) || ( echo \"There are local uncommitted changes after one or both of 'npm install' or 'npm run docs:build'!\" && exit 1 );",
155-
"ci": "concurrently \"npm run lint\" \"npm run test-unit:ci\" \"npm run check-local-changes\"",
156155
"predev": "npm run check-engines",
157156
"dev": "npm run build:packages && concurrently \"cross-env webpack --watch\" \"npm run dev:packages\"",
158157
"dev:packages": "node ./bin/packages/watch.js",
@@ -183,7 +182,6 @@
183182
"test-unit": "wp-scripts test-unit-js --config test/unit/jest.config.json",
184183
"test-unit:update": "npm run test-unit -- --updateSnapshot",
185184
"test-unit:watch": "npm run test-unit -- --watch",
186-
"test-unit:ci": "npm run test-unit -- --ci --runInBand",
187185
"test-unit-php": "docker-compose run --rm wordpress_phpunit phpunit",
188186
"test-unit-php-multisite": "docker-compose run -e WP_MULTISITE=1 --rm wordpress_phpunit phpunit"
189187
},

0 commit comments

Comments
 (0)