Skip to content

Commit

Permalink
Optimize Travis CI integration
Browse files Browse the repository at this point in the history
- Cache npm and nvm artifacts
- Use jest caching
- Run E2E tests in parallel
  • Loading branch information
noisysocks committed Dec 27, 2018
1 parent 7ea5021 commit 45eda12
Showing 1 changed file with 47 additions and 19 deletions.
66 changes: 47 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,84 @@ 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
- node_modules

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 install
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 -- $( 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 -- $( 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 -- $( 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 -- $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests )

0 comments on commit 45eda12

Please sign in to comment.