When we run our build suites on Travis Pro the bundling step takes the most time by a wide margin (aside from the test script itself).
Inspired by this Coderwall protip by Michał Czyż, I set about attempting to cache our completed gem bundle on S3.
How it works
- The tarballed bundle and a SHA-2 sum of the
Gemfile.lockare downloaded from S3 (if they exist)
- Travis runs
bundle installas normal (except that the bundle is installed to
~/.bundle). This shouldn't take more than a few seconds if the bundle hasn't changed.
- Travis executes all the normal build steps, as usual
- The bundle is tarballed and uploaded to S3 (us-east is the closest region to the new Travis workers), but only if the SHA-2 hash for the
Step by step instructions
Read more on my blog… (I didn't want to repost the entire blog post here)