From 8cf3af14864ac1bee4b3145bec8a8cf3e38edc55 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Wed, 10 Apr 2019 16:29:29 -0400 Subject: [PATCH] test: optimize total Travis run time * skip compilation by using cache * split testing into two jobs * DRY with YAML anchors PR-URL: https://github.com/nodejs/node/pull/27182 Refs: https://github.com/nodejs/node/pull/27158 Reviewed-By: Richard Lau Reviewed-By: Rich Trott --- .travis.yml | 59 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5fe00ad55c03a7..98bfbe432ab3a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" @@ -21,7 +28,6 @@ jobs: - NODE=$(which node) make lint lint-py - name: "Compile V8" - language: cpp cache: ccache addons: apt: @@ -29,13 +35,12 @@ jobs: - 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: @@ -43,27 +48,35 @@ jobs: - 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