Skip to content

Instantly share code, notes, and snippets.

@perlun
Last active April 14, 2019 07:52
Show Gist options
  • Save perlun/a20924957203d4fc202e9b6523d79598 to your computer and use it in GitHub Desktop.
Save perlun/a20924957203d4fc202e9b6523d79598 to your computer and use it in GitHub Desktop.
Super-fast Travis JRuby install
# Background: JRuby installs on Travis is painfully slow. The version which is preinstalled is very old. Here are some GitHub
# issues about it:
#
# https://github.com/travis-ci/docs-travis-ci-com/pull/743
# https://github.com/travis-ci/travis-rubies/issues/22
# https://github.com/travis-ci/travis-ci/issues/6892
# https://github.com/travis-ci/packer-templates/issues/391
#
# Since the upstream issue is still unresolved, and a JRuby install takes anywhere from 100 to 200 seconds (!), we decided to
# implement this workaround. With this in place, the JRuby install takes about 10 seconds.
sudo: false
language: ruby
# Dummy version to avoid wasting time on RVM installs.
rvm: 1.9.3
before_install:
- if [ ! -d "$HOME/jruby-bin" ]; then mkdir -p ~/jruby-bin && pushd ~/jruby-bin && curl -o- -L https://s3.amazonaws.com/jruby.org/downloads/9.1.8.0/jruby-bin-9.1.8.0.tar.gz | tar xzf - --strip-components=1 && popd ; fi
- export PATH="$HOME/jruby-bin/bin:$PATH"
- gem install bundler
# The rest of your .travis.yml content goes here (run specs, build app etc).
@perlun
Copy link
Author

perlun commented Apr 3, 2017

Downside: breaks caching of Bundler packages (seems to use the Ruby version given in .rvm to perform the caching). Fixed in the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment