Last active
December 7, 2015 14:55
-
-
Save jsuereth/56bd6f63138f5877f9b8 to your computer and use it in GitHub Desktop.
Travis CI caching hackeries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# very simple script to generate a tar of dependencies in ivy cache for extraction in TravisCI. | |
# usage: ./.create-travis-cache.sh <sbt-command>* | |
# | |
# By Default this will run `sbt update` with a clean cache directory and | |
# generate a .tar.bz2 with all the artifacts. This file can be pushed into | |
# dropbox and expanded in your TravisCI server later for a slight improvement | |
# in resolution times. | |
STAGING_DIR="$(pwd)/sbt-zipped-home-cache" | |
TAR_NAME=sbt-cache.tar.bz2 | |
# Create ivy cache of artifacts used | |
makeCache() { | |
echo "Generating ivy cache..." | |
sbt -d -Dsbt.boot.directory=${STAGING_DIR}/.sbt/boot -Dsbt.ivy.home=${STAGING_DIR}/.ivy2 -Divy.home=${STAGING_DIR}/.ivy2 update $@ | |
} | |
# Create a new staging directory to save things. | |
makeTar() { | |
pushd $STAGING_DIR | |
# Now generate the TAR | |
echo "Generating $TAR_NAME ..." | |
tar -cjvf $TAR_NAME .ivy2 .sbt >/dev/null 2>&1 | |
#Now pop, we're done. | |
popd | |
} | |
mkdir -p $STAGING_DIR/.ivy2 | |
# Here we pass in optional commands to run. | |
makeCache "$@" | |
makeTar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WORKAROUND lack of caching in public repos: | |
# http://docs.travis-ci.com/user/caching/ | |
curl -L https://www.dropbox.com/s/7v8qrukd6wmoydz/sbt-cache.tar.bz2 | tar xjf - -C $HOME | |
# always succeed: the cache is optional | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: scala | |
install: | |
- bash ./.load-travis-cache.sh | |
.... TODO - YOUR STUFF HERE ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typo in language.
also to be more general, using
bash
directly might be better incase people forget to chmod 755