Getting Started: Ruby

rails
ruby
getting-started
cci2-doc

#1

Documentation for this topic is now available on our documentation site: https://circleci.com/docs/2.0/language-ruby/


#2

For anyone coming by, this is a more complete version using mysql, caching gems and if you are using simplecov saving the simplecov artifacts

version: 2
executorType: docker
containerInfo:
  - image: ruby:2.3.1
    env:
      - DB_PASSWORD=my-password
      - DB_HOST=127.0.0.1
  - image: mariadb:5.5
    env:
      - MYSQL_ROOT_PASSWORD=my-password
stages:
  build:
    workDir: /my-project
    steps:
      - type: checkout
      - type: shell
        name: Install System Dependencies
        command: apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev nodejs
      - type: cache-restore
        key: gemfile-{{ checksum "Gemfile.lock" }}
      - type: shell
        name: Install Ruby Dependencies
        command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
      - type: cache-save
        key: gemfile-{{ checksum "Gemfile.lock" }}
        paths:
          - vendor/bundle
      - type: shell
        name: Create DB
        command: bundle exec rake db:create db:schema:load --trace
      - type: shell
        name: Run Tests
        command: bundle exec rake test TESTOPTS="--ci-dir=/tmp/circle-junit"
      - type: artifacts-store
        path: coverage
        destination: coverage
      - type: test-results-store
        path: /tmp/circle-junit

Looking forward to own Docker images but from what I’m reading on other threads cache is still a WIP keep the good work guys


Rails mysql container/connection
#3

#4