Skip to content

Instantly share code, notes, and snippets.

@MothOnMars
Last active June 7, 2019 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MothOnMars/1c4ef90e33d5b23691874f4c0fdd72fe to your computer and use it in GitHub Desktop.
Save MothOnMars/1c4ef90e33d5b23691874f4c0fdd72fe to your computer and use it in GitHub Desktop.
Run specs against multiple Ruby versions in CircleCi
#.circleci/config.yml
version: 2.1
executors:
test_executor:
docker:
- image: circleci/ruby:${RUBY_VERSION}
working_directory: ~/app
jobs:
build:
environment:
RUBY_VERSION: << parameters.ruby_version >>
executor: test_executor
parameters:
ruby_version:
type: string
steps:
- checkout
- restore_cache:
key: bundle-{{ checksum "Gemfile.lock" }}
- run: bundle check || bundle install --path vendor/bundle
- run: rubocop
- save_cache:
key: bundle-{{ checksum "Gemfile.lock" }}
paths:
- ~/app/vendor/bundle
- run:
name: RSpec
command: bundle exec rspec spec
workflows:
build_and_test:
jobs:
- build:
name: 'ruby 2.4.5'
ruby_version: 2.4.5
- build:
name: 'ruby 2.5.5'
ruby_version: 2.5.5
- build:
name: 'ruby 2.6.2'
ruby_version: 2.6.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment