Skip to content

Commit

Permalink
CI: Cache toolchain instead of always downloading it
Browse files Browse the repository at this point in the history
This instructs Travis-CI to cache the contents of the ~/toolchain/
directory.  The "install" step is modified to use of "curl --time-cond"
passing ~/toolchain/.installed as the time reference, which makes curl
use the "If-Modified-Since" HTTP header to avoid re-downloading the
toolchain installer if the already installed toolchain (from the cache)
is as new as the installer file hosted by the server.
  • Loading branch information
aperezdc committed Aug 19, 2019
1 parent 6f1be78 commit aa154fd
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .travis.yml
Expand Up @@ -16,9 +16,22 @@ addons:
- cmake
- ninja-build

cache:
directories:
- $HOME/toolchain

install:
- 'wget -O ~/toolchain.sh "${TOOLCHAINS_URL}/${TOOLCHAIN_NAME}"'
- chmod +x ~/toolchain.sh && ~/toolchain.sh -d ~/toolchain -y
- |-
: 'Downloading toolchain'
curl --progress-bar --retry 3 --time-cond ~/toolchain/.installed -L -o ~/toolchain.sh "${TOOLCHAINS_URL}/${TOOLCHAIN_NAME}"
- |-
: 'Installing toolchain'
if [[ -r ~/toolchain.sh ]] ; then
rm -rf ~/toolchain/
chmod +x ~/toolchain.sh && ~/toolchain.sh -d ~/toolchain/ -y && touch ~/toolchain/.installed
else
echo 'Cached toolchain already up to date'
fi
script:
- source ~/toolchain/environment-setup-armv7at2hf-neon-poky-linux-gnueabi
Expand Down

0 comments on commit aa154fd

Please sign in to comment.