Skip to content

Commit

Permalink
Update CI config to test multiple ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
aharpervc committed Mar 1, 2021
1 parent f9ca54f commit 085d13a
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
version: 2
version: 2.1

jobs:
build:
test:
parameters:
ruby_version:
type: string

docker:
- image: circleci/ruby:2.5.3
- image: circleci/ruby:<< parameters.ruby_version >>
- image: consul:1.3.0
- image: vault:0.11.3
environment:
Expand All @@ -19,9 +24,9 @@ jobs:
- restore_cache:
name: restore gem cache
keys:
- v1-bundle-{{ .Branch }}-{{ checksum "consult.gemspec" }}
- v1-bundle-{{ .Branch }}-
- v1-bundle-
- v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "consult.gemspec" }}
- v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-
- v1-bundle-<< parameters.ruby_version >>-

- run:
name: install dependencies
Expand All @@ -33,7 +38,7 @@ jobs:
name: save gem cache
paths:
- ./vendor/bundle
key: v1-bundle-{{ .Branch }}-{{ checksum "consult.gemspec" }}
key: v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "consult.gemspec" }}

- run:
name: setup fixture data
Expand All @@ -43,21 +48,31 @@ jobs:
- run:
name: run tests
command: |
mkdir /tmp/test-results
mkdir /tmp/<< parameters.ruby_version >>/test-results
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
circleci tests split --split-by=timings)"
bundle exec rspec \
--format progress \
--format RspecJunitFormatter \
--out /tmp/test-results/rspec.xml \
--out /tmp/<< parameters.ruby_version >>/test-results/rspec.xml \
--format progress \
$TEST_FILES
- store_test_results:
path: /tmp/test-results
path: /tmp/<< parameters.ruby_version >>/test-results

- store_artifacts:
path: /tmp/test-results
path: /tmp/<< parameters.ruby_version >>/test-results
destination: test-results

workflows:
test_supported_ruby_versions:
jobs:
- test:
matrix:
parameters:
ruby_version:
- '2.5'
- '2.7'

0 comments on commit 085d13a

Please sign in to comment.