version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.6.2
        environment:
          BUNDLE_JOBS: 3
          BUNDLE_RETRY: 3
          BUNDLE_PATH: vendor/bundle
    steps:
      - checkout

      # Which version of bundler?
      - run:
          name: Which bundler?
          command: bundle -v

      # Restore bundle cache
      - restore_cache:
          keys:
            - bundler-packages-{{ checksum "circuitdata.gemspec" }}

      - run:
          name: Bundle Install
          command: bundle check || bundle install

      # Store bundle cache
      - save_cache:
          key: bundler-packages-{{ checksum "circuitdata.gemspec" }}
          paths:
            - vendor/bundle
      - run:
          name: Run rspec
          command: |
            bundle exec rspec --profile 10 \
                              --format RspecJunitFormatter \
                              --out test_results/rspec.xml \
                              --format progress
      # Save test results for timing analysis
      - store_test_results:
          path: test_results

version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.6.2
        environment:
          BUNDLE_JOBS: 3
          BUNDLE_RETRY: 3
          BUNDLE_PATH: vendor/bundle
    steps:
      - checkout

      # Which version of bundler?
      - run:
          name: Which bundler?
          command: bundle -v

      # Restore bundle cache
      - restore_cache:
          keys:
            - bundler-packages-{{ checksum "circuitdata.gemspec" }}

      - run:
          name: Bundle Install
          command: bundle check || bundle install

      # Store bundle cache
      - save_cache:
          key: bundler-packages-{{ checksum "circuitdata.gemspec" }}
          paths:
            - vendor/bundle
      - run:
          name: Check code formatting
          command: bundle exec rufo -c .
      - run:
          name: Run rspec
          command: |
            bundle exec rspec --profile 10 \
                              --format RspecJunitFormatter \
                              --out test_results/rspec.xml \
                              --format progress
      # Save test results for timing analysis
      - store_test_results:
          path: test_results

Check code formatting on CI
Check code formatting on CI
