.circleci/config.yml
version: 2.1
executors:
ruby:
parameters:
version:
description: 'Ruby version number'
default: '3.1.1'
type: string
docker:
- image: cimg/ruby:<< parameters.version >>
commands:
bundle_install:
description: Install Ruby dependencies with Bundler
parameters:
version:
description: 'Ruby version number'
default: '3.1.1'
type: string
steps:
- restore_cache:
keys:
- bundle-v1-{{ arch }}-<< parameters.version >>
- run:
name: Install Ruby Dependencies
command: |
gem install bundler -v 2.3.8 --conservative --no-document
bundle config --local path vendor/bundle
bundle check || (bundle install --jobs=4 --retry=3 && bundle clean)
- save_cache:
paths:
- ./vendor/bundle
key: bundle-v1-{{ arch }}-<< parameters.version >>-{{ checksum "Gemfile.lock" }}
jobs:
rubocop:
executor: ruby
steps:
- checkout
- bundle_install
- run: bundle exec rubocop
test:
parameters:
version:
description: 'Ruby version number'
default: '3.1.1'
type: string
executor:
name: ruby
version: << parameters.version >>
steps:
- checkout
- bundle_install:
version: << parameters.version >>
- run: bundle exec rake test TESTOPTS="--ci-dir=./reports"
- store_test_results:
path: ./reports
workflows:
version: 2
commit-workflow:
jobs:
- rubocop
- test:
matrix:
parameters:
version: ['2.6.9', '2.7.5', '3.0.3', '3.1.1']
cron-workflow:
jobs:
- rubocop
- test:
matrix:
parameters:
version: ['2.6.9', '2.7.5', '3.0.3', '3.1.1']
triggers:
- schedule:
cron: '0 13 * * 6'
filters:
branches:
only:
- main