I wonder how to install it quickly and portably. If I run cargo install sccache it takes way longer than any savings from the cache itself. I've tried to use a prebuilt binary using MUSL, but sccache depends on openssl which was too hard to compile portably.
I wonder how to install it quickly and portably. If I run cargo install sccache it takes way longer than any savings from the cache itself.
Not the greatest solution but you could rely on caches
env:
SCCACHE_VERSION=0.2.6
...
install:
- cargo install sccache --version $SCCACHE_VERSION || echo "Reusing sccache from CI cache"
No need to --force to upgrade; Travis flushes its caches when environment variables change.
If the build takes too long, you could use travis_wait
You do need to keep your fresh builds under 50 minutes or so. From some past experience, somewhere around there is Travis' hard cutoff for all steps within a build.
Is the install: phase special in regards to caching? I've tried relying on cache: cargo when building sccache as part of script: phase, but I'm getting very low cache hit ratio from Travis', which is why I was looking for some other trick.
A possible approach is to download the release tarball from Github. The sccache binary will be cached in the Cargo cache so the download can be skipped if it is already there.
env:
global:
- RUSTC_WRAPPER=sccache
- SCCACHE_VERSION=0.2.13
cache:
- cargo
before_install:
- which sccache || travis_retry curl -Lo /tmp/sccache.tar.gz https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz
- which sccache || tar -xzf /tmp/sccache.tar.gz --directory=/tmp/
- which sccache || cp /tmp/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache ${TRAVIS_HOME}/.cargo/bin