deliveroo/routemaster-drain

View on GitHub
.circleci/config.yml.erb

Summary

Maintainability
Test Coverage
# To update the build configuration, edit the "builds" array below and run:
# erb .circleci/config.yml.erb > .circleci/config.yml
<%
  builds = [
        ['2.3.4', 'rails_3'],
        ['2.3.4', 'rails_4'],
        ['2.4.1', 'rails_4'],
        ['2.3.4', 'rails_5'],
        ['2.4.1', 'rails_5']
  ]
%>
version: 2
jobs:
<% builds.each do |ruby,variant| %>
  build_<%= ruby %>_<%= variant %>:
    docker:
      - image: deliveroo/multiruby
      - image: redis:3-alpine
    steps:
      - checkout

      - run:
          name: Select build variant (Ruby <%= ruby %>, <%= variant %>)
          command: |
            rbenv local <%= ruby %> ;
            gem install bundler -v '~> 1.17' ;
            bundle config --local gemfile $PWD/gemfiles/<%= variant %>.gemfile

      - restore_cache:
          keys: 
            - v2-bundle-<%= ruby %>-<%= variant %>-{{ .Branch }}
            - v2-bundle-<%= ruby %>-<%= variant %>
            - v2-bundle-<%= ruby %>

      - run: 
          name: Install dependencies
          command: |
            bundle install --jobs=3 --retry=3 --path=$PWD/vendor/bundle

      - run:
          name: Run test suite
          command: |
            unset RACK_ENV &&
            unset RAILS_ENV &&
            bundle exec rspec

      - save_cache:
          key: v2-bundle-<%= ruby %>-<%= variant %>-{{ .Branch }}
          paths:
            - ~/project/vendor/bundle
      - save_cache:
          key: v2-bundle-<%= ruby %>-<%= variant %>
          paths:
            - ~/project/vendor/bundle
      - save_cache:
          key: v2-bundle-<%= ruby %>
          paths:
            - ~/project/vendor/bundle
<% end %>

workflows:
  version: 2
  test:
    jobs:
    <% builds.each do |ruby,variant| %>
      - build_<%= ruby %>_<%= variant %>
    <% end %>