Skip to content

Ruby

This guide provides a walkthrough for a Ruby based application and how to configure common CI tasks. We recommend you use docker based workflow for easier operations and immutable deployment. If not, you can directly jump below to use non-docker based tasks.

Downloading dependencies

You can use official ruby docker image and provide commands to download dependencies -

tasks:
  build-deps:
    runner: ruby:2.6
    steps:
    - run: bundle install --deployment

Read more how to use this image on dockerhub docs.

Tip

You can further speedup the workflow by caching bundler dependencies so that every subsequent build then performs just incremental changes on top of that during bnudle install which may lead to even faster builds.

Execute test suite

Using official node docker image:

tasks:
  build-deps:
    runner:
      containers:
        - image: ruby:2.6
          environment:
            - DATABASE_URL: postgres://[email protected]:5432
        - image: postgres:9.6
    steps:
    - commands:
      - bundle install || bundle check
      - bundle exec rspec

You can additionally provide environment variables and provide service dependencies to run your test suite.