This article is about Codeship Basic.


You'll need roughly 6 minutes to read this article.

Versions And Setup


We use RVM to manage different Ruby and JRuby versions. We set 2.1.7 as the default version. Currently we do not automatically load the Ruby version from your Gemfile. You can always change the Ruby version by running:


The following Ruby versions are preinstalled:

   default [ x86_64 ]
   jruby-1.7.21 [ x86_64 ]
   jruby-1.7.22 [ x86_64 ]
   jruby-1.7.23 [ x86_64 ]
   jruby-1.7.24 [ x86_64 ]
   jruby-1.7.25 [ x86_64 ]
   jruby-1.7.26 [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   jruby- [ x86_64 ]
   ruby-1.8.7-p374 [ x86_64 ]
   ruby-1.9.2-p320 [ x86_64 ]
   ruby-1.9.3-p551 [ x86_64 ]
   ruby-2.0.0-p648 [ x86_64 ]
   ruby-2.1.0 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]
   ruby-2.1.10 [ x86_64 ]
   ruby-2.1.2 [ x86_64 ]
   ruby-2.1.3 [ x86_64 ]
   ruby-2.1.4 [ x86_64 ]
   ruby-2.1.5 [ x86_64 ]
   ruby-2.1.6 [ x86_64 ]
=* ruby-2.1.7 [ x86_64 ]
   ruby-2.1.8 [ x86_64 ]
   ruby-2.1.9 [ x86_64 ]
   ruby-2.2.0 [ x86_64 ]
   ruby-2.2.1 [ x86_64 ]
   ruby-2.2.2 [ x86_64 ]
   ruby-2.2.3 [ x86_64 ]
   ruby-2.2.4 [ x86_64 ]
   ruby-2.2.5 [ x86_64 ]
   ruby-2.2.6 [ x86_64 ]
   ruby-2.2.7 [ x86_64 ]
   ruby-2.2.8 [ x86_64 ]
   ruby-2.2.9 [ x86_64 ]
   ruby-2.3.0 [ x86_64 ]
   ruby-2.3.1 [ x86_64 ]
   ruby-2.3.2 [ x86_64 ]
   ruby-2.3.3 [ x86_64 ]
   ruby-2.3.4 [ x86_64 ]
   ruby-2.3.5 [ x86_64 ]
   ruby-2.3.6 [ x86_64 ]
   ruby-2.4.0 [ x86_64 ]
   ruby-2.4.1 [ x86_64 ]
   ruby-2.4.2 [ x86_64 ]
   ruby-2.4.3 [ x86_64 ]
   ruby-2.5.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Using a .ruby-version file

You can also use your .ruby-version file on Codeship. The .ruby-version file lives in the project root and its content is just your Ruby version, for example: 2.4.2. You can read the Ruby version to use from that file:

rvm use $(cat .ruby-version) --install

One use case is that you can change your Ruby version for different branches.


You can install dependencies using bundler in your setup commands.

For example:

gem install bundler
bundle install

Dependency Cache

Codeship automatically configures bundler to use the $HOME/cache/bundler directory, which we save between builds to optimize build performance. You can read this article to learn more about the dependency cache and how to clear it.

Frameworks And Testing

Our Ruby support includes Ruby itself, Rails, Sinatra and most other frameworks that do not require root-access for customized system configuration.

We also support all Ruby based test frameworks like RSpec, Cucumber and Minitest.

Capybara is also supported out of the box with the selenium-webdriver, capybara-webkit or the poltergeist driver for PhantomJS.

Parallel Testing

If you are running parallel test pipelines, you will want to separate your RSpec tests into groups and call a group specifically in each pipeline. For instance:

Pipeline 1:

rspec spec/spec_1

Pipeline 2:

rspec spec/spec_2

Parallelization Gems

In addition to parallelizing your tests explicitly with parallel pipelines, there are a couple Rails gems that are popular ways to parallelize within your codebase.

While we do not officially support or integrate with these modules, many Codeship users find success speeding their tests up by using them. Note that it is possible for these gems to cause resource and build failure issues.

Notes And Known Issues


On Ruby 2.3 only, Nokogiri will fail to compile with the bundled libxml and libxslt libraries. To install the gem you need to use the system libraries instead.

# Add the following command before running "bundle install"
bundle config build.nokogiri --use-system-libraries

Run With Bundle Exec

Make sure to run your commands with bundle exec (e.g. bundle exec rspec) so all commands you run are executed with the versions of the Ruby gems you configured in your Gemfile.lock.

Can Not Find Gem In Sources

Sometimes you might see errors like the following:

Could not find safe_yaml-0.9.2 in any of the sources

Please make sure the version of the gem you want to install wasn’t removed from RubyGems.

RVM Requires Curl

Any Ruby version you might need should already be installed by default, however if you are trying to manually install a version with RVM you may encounter the following error:

RVM requires 'curl'. Install 'curl' first and try again.

This error typically occurs when the NPM package node-which is installed. You can check if it is present in the build with:

$ which which

To workaround this, temporarily remove the NPM version of which, then run your rvm command. After that completes you can let the package reinstall with either npm install or yarn install. To remove it, add this command at the start of your Setup Steps:

rm -f node_modules/.bin/which

Custom Bundler Version

The build environment will always include a recent version of Bundler by default. If you have a situation where you need to install a specific Bundler version you can do so by adding the following commands to your build:

gem uninstall -x -a bundler
rvm @global do gem uninstall -x -a bundler
gem install bundler -v YOUR_BUNDLER_VERSION