We use RVM to manage different Ruby and JRuby versions. We set
2.6.6 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:
rvm use RUBY_VERSION_YOU_WANT_TO_USE --install
Most Ruby versions are preinstalled, but if you need an older version the
--install flag will automatically install the version for you at build time.
The following Ruby versions are preinstalled:
jruby-22.214.171.124 [ x86_64 ] jruby-126.96.36.199 [ x86_64 ] jruby-188.8.131.52 [ x86_64 ] jruby-184.108.40.206 [ x86_64 ] ruby-2.1.10 [ x86_64 ] ruby-2.2.10 [ 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.3.7 [ x86_64 ] ruby-2.3.8 [ 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.4.4 [ x86_64 ] ruby-2.4.5 [ x86_64 ] ruby-2.4.6 [ x86_64 ] ruby-2.4.7 [ x86_64 ] ruby-2.4.9 [ x86_64 ] ruby-2.4.10 [ x86_64 ] ruby-2.5.0 [ x86_64 ] ruby-2.5.1 [ x86_64 ] ruby-2.5.2 [ x86_64 ] ruby-2.5.3 [ x86_64 ] ruby-2.5.4 [ x86_64 ] ruby-2.5.5 [ x86_64 ] ruby-2.5.6 [ x86_64 ] ruby-2.5.7 [ x86_64 ] ruby-2.5.8 [ x86_64 ] ruby-2.5.9 [ x86_64 ] ruby-2.6.0 [ x86_64 ] ruby-2.6.1 [ x86_64 ] ruby-2.6.2 [ x86_64 ] ruby-2.6.3 [ x86_64 ] ruby-2.6.4 [ x86_64 ] ruby-2.6.5 [ x86_64 ] =* ruby-2.6.6 [ x86_64 ] ruby-2.6.7 [ x86_64 ] ruby-2.6.8 [ x86_64 ] ruby-2.6.9 [ x86_64 ] ruby-2.6.10 [ x86_64 ] ruby-2.7.0 [ x86_64 ] ruby-2.7.1 [ x86_64 ] ruby-2.7.2 [ x86_64 ] ruby-2.7.3 [ x86_64 ] ruby-2.7.4 [ x86_64 ] ruby-2.7.5 [ x86_64 ] ruby-2.7.6 [ x86_64 ] ruby-2.7.7 [ x86_64 ] ruby-3.0.0 [ x86_64 ] ruby-3.0.1 [ x86_64 ] ruby-3.0.2 [ x86_64 ] ruby-3.0.3 [ x86_64 ] ruby-3.0.4 [ x86_64 ] ruby-3.0.5 [ x86_64 ] ruby-3.1.0 [ x86_64 ] ruby-3.1.1 [ x86_64 ] ruby-3.1.2 [ x86_64 ] ruby-3.1.3 [ x86_64 ] ruby-3.2.0 [ x86_64 ] # => - current # =* - current && default # * - default
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.7.4. 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.
If you need to install a version of JRuby that is not already installed by default you can do so with:
rvm use jruby-JRUBY_VERSION_YOU_WANT_TO_USE --install
gem install bundler -v BUNDLER_VERSION_YOU_WANT_TO_USE bundle install
In some cases you may need to update RubyGems first with:
gem update --system
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
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:
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.
Nokogiri might fail to compile with the bundled libxml and libxslt libraries. To install the gem you need to use the system libraries instead.
The error may look like this:
Fetching nokogiri 1.8.2 Installing nokogiri 1.8.2 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Fix it by adding this command before
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 the version of the gem you want to install wasn’t removed from RubyGems.
If you are manually installing a Ruby 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 node_modules/.bin/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
Each preinstalled Ruby version will 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 after setting the Ruby version:
gem uninstall -x -a bundler rvm @global do gem uninstall -x -a bundler gem install bundler -v YOUR_BUNDLER_VERSION
\curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/freetds.sh | bash -s
Following the install add this command before running
bundle config build.tiny_tds --with-freetds-lib=$HOME/cache/freetds/lib --with-freetds-include=$HOME/cache/freetds/include
The Puma gem will fail to install by default if the version is older than 3.7. Older Puma versions use OpenSSL 1.0, but Ubuntu Bionic includes OpenSSL 1.1 by default. You can either upgrade Puma to at least 3.7 or revert to the older OpenSSL version.
The error may look like this:
Fetching puma 3.6.0 Installing puma 3.6.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Revert to OpenSSL 1.0 by adding these commands before
sudo apt-get update sudo apt-get install -y libssl1.0-dev