Skip to content

Commit

Permalink
test: optimize total Travis run time
Browse files Browse the repository at this point in the history
* skip compilation by using cache
* split testing into two jobs
* DRY with YAML anchors

PR-URL: nodejs#27182
Refs: nodejs#27158
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
refack committed Apr 12, 2019
1 parent 060d901 commit 8cf3af1
Showing 1 changed file with 36 additions and 23 deletions.
59 changes: 36 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
x-ccache-setup-steps: &ccache-setup-steps
- export CCACHE_NOSTATS=1
- export CCACHE_SLOPPINESS="file_macro,include_file_mtime,include_file_ctime,time_macros,file_stat_matches"
- export CC='ccache gcc-6'
- export CXX='ccache g++-6'

os: linux
dist: xenial
language: cpp
jobs:
include:
- stage: "Lint and Compile"
Expand All @@ -21,49 +28,55 @@ jobs:
- NODE=$(which node) make lint lint-py

- name: "Compile V8"
language: cpp
cache: ccache
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
install:
- CC='ccache gcc-6' CXX='ccache g++-6' ./configure
install: *ccache-setup-steps
script:
- CC='ccache gcc-6' CXX='ccache g++-6' make -j2 -C out V=1 v8
- ./configure
- make -j2 -C out V=1 v8

- name: "Compile Node.js"
language: cpp
cache: ccache
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
install:
- CC='ccache gcc-6' CXX='ccache g++-6' ./configure
install: *ccache-setup-steps
script:
- CC='ccache gcc-6' CXX='ccache g++-6' make -j2 V=1
- ./configure
- make -j2 V=1
- cp out/Release/node /home/travis/.ccache
- cp out/Release/cctest /home/travis/.ccache

- stage: "Tests"
name: "Test Suite"
language: cpp
name: "Test JS Suites"
cache: ccache
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
install:
- export CC='ccache gcc-6' CXX='ccache g++-6' JOBS=2
- ./configure
# We already have a compile log in the above job
- make -j2 > /dev/null
- make -j1 build-addons build-js-native-api-tests build-node-api-tests > /dev/null
- mkdir -p out/Release
- cp /home/travis/.ccache/node out/Release/node
script:
- python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare default

- name: "Test C++ Suites"
cache: ccache
install:
- export CCACHE_NOSTATS=1
- export CCACHE_SLOPPINESS="file_macro,include_file_mtime,include_file_ctime,time_macros,file_stat_matches"
- export CC='ccache gcc'
- export CXX='ccache g++'
- mkdir -p out/Release
- cp /home/travis/.ccache/node out/Release/node
- ln -fs out/Release/node node
- cp /home/travis/.ccache/cctest out/Release/cctest
- touch config.gypi
script:
- set -o pipefail
- JOBS=2 FLAKY_TESTS=dontcare make -s -j1 V= test-ci | grep -F -e "---" -e "..." -v
- out/Release/cctest
- make -j1 V=1 test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp
- python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare addons js-native-api node-api

0 comments on commit 8cf3af1

Please sign in to comment.