@@ -3,14 +3,19 @@ version: 2.1
33defaults : &defaults
44 working_directory : ~/ruby-dns-mock
55 docker :
6- - image : circleci /ruby:2.5.0-node
6+ - image : cimg /ruby:<< parameters.ruby-version >>
77 environment :
88 CC_TEST_REPORTER_ID : 18fba9e7d6885c48453a80a0f019a60d9ffa3fd80467652a6b3c95fef5ea9a50
99
1010orbs :
11- ruby :
circleci/[email protected] .2 11+ ruby :
circleci/[email protected] .3 1212
1313references :
14+ install_bundler : &install_bundler
15+ run :
16+ name : Installing bundler
17+ command : gem i bundler -v $(tail -1 Gemfile.lock | tr -d ' ')
18+
1419 restore_bundle_cache : &restore_bundle_cache
1520 restore_cache :
1621 keys :
@@ -29,18 +34,23 @@ references:
2934
3035 install_codeclimate_reporter : &install_codeclimate_reporter
3136 run :
32- name : Install Code Climate Test Reporter
37+ name : Install Code Climate test reporter
3338 command : |
3439 curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
3540 chmod +x ./cc-test-reporter
3641
3742jobs :
38- linters :
43+ linters-with-ruby :
44+ parameters :
45+ ruby-version :
46+ type : string
47+
3948 << : *defaults
4049
4150 steps :
4251 - checkout
4352
53+ - << : *install_bundler
4454 - << : *restore_bundle_cache
4555 - << : *bundle_install
4656 - << : *save_bundle_cache
@@ -51,12 +61,17 @@ jobs:
5161 bundle exec overcommit -s
5262 SKIP=AuthorEmail,AuthorName bundle exec overcommit -r
5363
54- tests :
64+ tests-and-coverage-with-ruby :
65+ parameters :
66+ ruby-version :
67+ type : string
68+
5569 << : *defaults
5670
5771 steps :
5872 - checkout
5973
74+ - << : *install_bundler
6075 - << : *restore_bundle_cache
6176 - << : *bundle_install
6277 - << : *save_bundle_cache
6580 - run :
6681 name : Running tests
6782 command : |
68- mkdir /tmp/test-results
6983 ./cc-test-reporter before-build
7084 bundle exec rspec
7185
7488 command : |
7589 ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
7690
77- - store_test_results :
78- path : /tmp/test-results
79-
8091 - store_artifacts :
81- path : /tmp/test-results
82- destination : test-results
92+ path : ~/ruby-dns-mock/coverage
93+ destination : coverage
8394
8495 - deploy :
8596 command : |
94105 steps :
95106 - checkout
96107 - ruby/install-deps :
97- bundler-version : ' 1.16.6'
98108 with-cache : false
99109 path : ' ./vendor/custom_bundle'
100110 - run :
@@ -104,8 +114,14 @@ jobs:
104114workflows :
105115 build_and_test :
106116 jobs :
107- - linters
108- - tests
117+ - linters-with-ruby :
118+ matrix :
119+ parameters :
120+ ruby-version : ["2.5"]
121+ - tests-and-coverage-with-ruby :
122+ matrix :
123+ parameters :
124+ ruby-version : ["2.5"]
109125 - compatibility-with-ruby :
110126 matrix :
111127 parameters :
0 commit comments