Skip to content

Commit

Permalink
Improve Travis CI build times (#13103)
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks authored and youknowriad committed Jan 4, 2019
1 parent 232012c commit 74c3d39
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 21 deletions.
65 changes: 46 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dist: trusty

language: php
language: generic

services:
- docker
Expand All @@ -13,56 +13,83 @@ notifications:
cache:
directories:
- $HOME/.composer/cache
- $HOME/.phpbrew
- $HOME/.jest-cache
- $HOME/.npm

before_install:
- nvm install && nvm use
- npm install npm -g
- $HOME/.nvm/.cache
- $HOME/.phpbrew

branches:
only:
- master

before_install:
- nvm install

jobs:
include:
- stage: test
- name: JS unit tests
env: WP_VERSION=latest
before_install:
- nvm install --latest-npm
install:
- npm ci
script:
- npm install || exit 1
- npm run ci || exit 1
- npm run lint
- npm run check-local-changes
- npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"

- stage: test
- name: PHP unit tests (Docker)
env: WP_VERSION=latest DOCKER=true
script:
- ./bin/run-wp-unit-tests.sh

- stage: test
- name: PHP unit tests (PHP 5.6)
language: php
php: 5.6
env: WP_VERSION=latest
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- stage: test
php: 7.1
- name: PHP unit tests (PHP 5.3)
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- stage: test
php: 7.1
- name: PHP unit tests (PHP 5.2)
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
script:
- ./bin/run-wp-unit-tests.sh

- stage: test
- name: E2E tests (Admin with plugins) (1/2)
env: WP_VERSION=latest POPULAR_PLUGINS=true
install:
- ./bin/setup-local-env.sh
script:
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests )

- name: E2E tests (Admin with plugins) (2/2)
env: WP_VERSION=latest POPULAR_PLUGINS=true
install:
- ./bin/setup-local-env.sh
script:
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )

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

- stage: test
- name: E2E tests (Author without plugins) (2/2)
env: WP_VERSION=latest E2E_ROLE=author
install:
- ./bin/setup-local-env.sh
script:
- ./bin/run-e2e-tests.sh || exit 1
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
"check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2\" \"wp-scripts check-licenses --dev\"",
"precheck-local-changes": "npm run docs:build",
"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 );",
"ci": "concurrently \"npm run lint\" \"npm run test-unit:ci\" \"npm run check-local-changes\"",
"predev": "npm run check-engines",
"dev": "npm run build:packages && concurrently \"cross-env webpack --watch\" \"npm run dev:packages\"",
"dev:packages": "node ./bin/packages/watch.js",
Expand Down Expand Up @@ -183,7 +182,6 @@
"test-unit": "wp-scripts test-unit-js --config test/unit/jest.config.json",
"test-unit:update": "npm run test-unit -- --updateSnapshot",
"test-unit:watch": "npm run test-unit -- --watch",
"test-unit:ci": "npm run test-unit -- --ci --runInBand",
"test-unit-php": "docker-compose run --rm wordpress_phpunit phpunit",
"test-unit-php-multisite": "docker-compose run -e WP_MULTISITE=1 --rm wordpress_phpunit phpunit"
},
Expand Down

0 comments on commit 74c3d39

Please sign in to comment.