Estimated Reading Time: 3 mins
We use RVM to manage different Ruby versions. We set ruby-2.1.7 as the default version. Currently we do not load the Ruby version from your Gemfile. You can always change the Ruby version by running:
rvm use RUBY_VERSION_YOU_WANT_TO_USE
The following Ruby versions are preinstalled
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.0.0-p195. You can just 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.
gem install bundler
If you want to use a version of bundler different than what is preinstalled on the VM, you will need to install bundler yourself by adding the following command to your setup steps
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.
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 from RSpec, Cucumber to Minitest or others.
Capybara is also supported out of the box with the selenium-webdriver , capybara-webkit or the poltergeist driver for phantomjs.
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
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
Sometimes you might see errors like the following:
Could not find safe_yaml-0.9.2 in any of the sources
Please make sure that the version of the gem you want to install there wasn’t yanked from Rubygems.
In addition to parallelizing your tests explicitly via 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, as well.