From 7d39774bbbee85166ed7a17c8d67cafa6a5bb890 Mon Sep 17 00:00:00 2001 From: Dominic Jodoin Date: Mon, 10 Dec 2018 12:58:45 -0500 Subject: [PATCH 1/4] Cache gcc and clang APT packages --- .travis.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b0ac21a..2bcf752f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,17 @@ matrix: env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 if: type != pull_request +before_install: + - | + if [ ! -f ${TRAVIS_BUILD_DIR}/apt-cache/pkgcache.bin ]; then + mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/archives/partial + mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/partial + mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/lists + sudo apt-get -y -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists update + sudo apt-get install --download-only -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 + fi + - sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 + # These are the install and build (script) phases for the most common entries in the matrix. They could be included # in each entry in the matrix, but that is just repetitive. install: @@ -63,9 +74,13 @@ addons: sources: - ubuntu-toolchain-r-test - llvm-toolchain-precise-3.9 - packages: - - g++-4.9 - - clang-3.9 + +before_cache: + - sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache + +cache: + directories: + - apt-cache notifications: email: false From a97b5e79b070a02ee9210df7df4107326cffa90a Mon Sep 17 00:00:00 2001 From: Dominic Jodoin Date: Tue, 11 Dec 2018 22:50:17 -0500 Subject: [PATCH 2/4] Change directory ownership earlier --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2bcf752f..e8a062ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,7 @@ before_install: sudo apt-get install --download-only -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 fi - sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 + - sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache # These are the install and build (script) phases for the most common entries in the matrix. They could be included # in each entry in the matrix, but that is just repetitive. @@ -75,9 +76,6 @@ addons: - ubuntu-toolchain-r-test - llvm-toolchain-precise-3.9 -before_cache: - - sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache - cache: directories: - apt-cache From 8a359b58f42a9b2e8d44ac02c17dddf16fa15994 Mon Sep 17 00:00:00 2001 From: Dominic Jodoin Date: Tue, 11 Dec 2018 23:58:13 -0500 Subject: [PATCH 3/4] Don't cache APT packages on OS X/macOS --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8a062ed..13b861ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,15 +46,15 @@ matrix: before_install: - | - if [ ! -f ${TRAVIS_BUILD_DIR}/apt-cache/pkgcache.bin ]; then + if [ "$TRAVIS_OS_NAME" != "osx" ] && [ ! -f ${TRAVIS_BUILD_DIR}/apt-cache/pkgcache.bin ]; then mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/archives/partial mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/partial mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/lists sudo apt-get -y -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists update sudo apt-get install --download-only -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 fi - - sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 - - sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache + - [ "$TRAVIS_OS_NAME" != "osx" ] && sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 + - [ "$TRAVIS_OS_NAME" != "osx" ] && sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache # These are the install and build (script) phases for the most common entries in the matrix. They could be included # in each entry in the matrix, but that is just repetitive. From 8f28dd775e82e8baae57d8e8cada8431ae46ab20 Mon Sep 17 00:00:00 2001 From: Dominic Jodoin Date: Wed, 12 Dec 2018 00:01:07 -0500 Subject: [PATCH 4/4] Use if statements --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 13b861ef..8ea55db5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,8 @@ before_install: sudo apt-get -y -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists update sudo apt-get install --download-only -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 fi - - [ "$TRAVIS_OS_NAME" != "osx" ] && sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9 - - [ "$TRAVIS_OS_NAME" != "osx" ] && sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache + - if [ "$TRAVIS_OS_NAME" != "osx" ]; then sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9; fi + - if [ "$TRAVIS_OS_NAME" != "osx" ]; then sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache; fi # These are the install and build (script) phases for the most common entries in the matrix. They could be included # in each entry in the matrix, but that is just repetitive.