version: 2 jobs: build: parallelism: 3 docker: - image: circleci/ruby:2.6.6 environment: BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle steps: - checkout - run: name: install Bundler command: | echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV source $BASH_ENV gem install bundler - run: name: Which bundler? command: bundle -v - restore_cache: keys: - gem-sample-{{ checksum "Gemfile.lock" }} - gem-sample- - run: name: Bundle Install command: bundle check --path vendor/bundle || bundle install --deployment - save_cache: key: gem-sample-{{ checksum "Gemfile.lock" }} paths: - vendor/bundle - run: name: run rubocop command: | bundle exec rubocop - run: name: Run rspec in parallel command: | bundle exec rspec --profile 10 \ --format RspecJunitFormatter \ --out test_results/rspec.xml \ --format progress \ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - store_test_results: path: test_results - store_artifacts: path: test_results destination: test-results - store_artifacts: path: coverage destination: coverage-results deploy: docker: - image: circleci/ruby:2.6.6 steps: - checkout - run: name: install Bundler command: | echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV source $BASH_ENV gem install bundler - run: name: Which bundler? command: bundle -v - restore_cache: keys: - gem-deploy-{{ checksum "Gemfile.lock" }} - gem-deploy- - run: name: Bundle Install command: bundle check --path vendor/bundle || bundle install - save_cache: key: gem-deploy-{{ checksum "Gemfile.lock" }} paths: - vendor/bundle workflows: version: 2 build-and-deploy: jobs: - build - deploy: requires: - build filters: branches: only: master