How to test your gem against multiple Ruby versions on CircleCIAugust 15, 2016 Circle CI Ruby RVM Travis CI
So I’ve recently released a new gem for MessagePack-RPC, and I had to test it against all kinds of Ruby versions of course. On Travis CI it’s trivial, and kudos to Travis for that.
But our client is using Circle CI, and it makes no sense to involve Travis just to test one single gem. Unfortunately, Circle CI doesn’t support a build matrix.
After trying out a couple third-party scripts for build matrices, I recalled that RVM can run commands against multiple rubies out of the box, with the rvm do command. You’ll have to override most of the build steps, but still it works really well.
Here’s the entire
circle.yml file I use:
machine: environment: RUBY_VERSIONS: 1.9.3,2.0.0,2.1.10,2.2.5,2.3.1,jruby-1.7.25,jruby-22.214.171.124 dependencies: override: - rvm get head - rvm install $RUBY_VERSIONS - rvm $RUBY_VERSIONS --verbose do gem install bundler - rvm $RUBY_VERSIONS --verbose do bundle install test: override: - rvm $RUBY_VERSIONS --verbose do bundle exec rspec spec
(Best thing about Circle CI though? Effortless parallel testing. And Clojure.)