version: 2

references:
  steps: &steps
    - checkout

    - run:
        name: Update Bundler
        command: gem install bundler

    - run:
        name: Install dependencies from .gemspec
        command: bundle install --jobs=4 --retry=3 --path vendor/bundle

    - run:
        name: Run RSpec tests
        command: |
          mkdir /tmp/test-results
          
          bundle exec rspec --format progress \
                          --format RspecJunitFormatter \
                          --out /tmp/test-results/rspec.xml \
                          --format progress \
                          spec/**/*_spec.rb

    - run:
        name: Check code style with Rubocop
        command: bundle exec rubocop

    - store_test_results:
        path: /tmp/test-results
    - store_artifacts:
        path: /tmp/test-results
        destination: test-results

jobs:
  build-ruby265:
    docker:
       - image: circleci/ruby:2.6.5
    steps: *steps
  build-ruby257:
    docker:
       - image: circleci/ruby:2.5.7
    steps: *steps
  build-ruby249:
    docker:
       - image: circleci/ruby:2.4.9
    steps: *steps
  build-ruby238:
    docker:
       - image: circleci/ruby:2.3.8
    steps: *steps

workflows:
  version: 2
  tests:
    jobs:
      - build-ruby265
      - build-ruby257
      - build-ruby249
      - build-ruby238
version: 2

references:
  steps: &steps
    - checkout

    - run:
        name: Update Bundler
        command: gem install bundler

    - run:
        name: Install dependencies from .gemspec
        command: bundle install --jobs=4 --retry=3 --path vendor/bundle

    - run:
        name: Run RSpec tests
        command: |
          mkdir /tmp/test-results
          
          bundle exec rspec --format progress \
                          --format RspecJunitFormatter \
                          --out /tmp/test-results/rspec.xml \
                          --format progress \
                          spec/**/*_spec.rb

    - run:
        name: Check code style with Rubocop
        command: bundle exec rubocop

    - store_test_results:
        path: /tmp/test-results
    - store_artifacts:
        path: /tmp/test-results
        destination: test-results

jobs:
  build-ruby265:
    docker:
       - image: circleci/ruby:2.6.5
    steps: *steps
  build-ruby257:
    docker:
       - image: circleci/ruby:2.5.7
    steps: *steps
  build-ruby249:
    docker:
       - image: circleci/ruby:2.4.9
    steps: *steps

workflows:
  version: 2
  tests:
    jobs:
      - build-ruby265
      - build-ruby257
      - build-ruby249
Stop testing against Ruby 2.3
Stop testing against Ruby 2.3
