Last Updated: February 25, 2016
· matiaskorhonen

Speed up Travis CI builds by caching the bundle to S3

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

  1. The tarballed bundle and a SHA-2 sum of the Gemfile.lock are downloaded from S3 (if they exist)
  2. Travis runs bundle install as normal (except that the bundle is installed to ~/.bundle). This shouldn't take more than a few seconds if the bundle hasn't changed.
  3. Travis executes all the normal build steps, as usual
  4. 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 Gemfile.lock has changed

Step by step instructions

Read more on my blog… (I didn't want to repost the entire blog post here)

2 Responses
Add your response

Link doesn't work 😢

over 1 year ago ·

Seems to be a Coderwall bug, I sent a message to their support address. Hopefully they'll fix it soon, but here's the address again:

Though Travis Pro has built-in caching now, so most of this isn't required anymore:

over 1 year ago ·