.circleci/config.yml in creditsafe-0.6.3 vs .circleci/config.yml in creditsafe-0.7.0

- old
+ new

@@ -1,17 +1,66 @@ -version: 2 +--- +version: 2.1 + +references: + bundle_install: &bundle_install + run: + name: Bundle + command: | + gem install bundler --no-document && \ + bundle config set no-cache 'true' && \ + bundle config set jobs '4' && \ + bundle config set retry '3' && \ + bundle install + + cache_bundle: &cache_bundle + save_cache: + key: bundle-<< parameters.ruby_version >>-{{ checksum "creditsafe.gemspec" }}-{{ checksum "Gemfile" }} + paths: + - vendor/bundle + + restore_bundle: &restore_bundle + restore_cache: + key: bundle-<< parameters.ruby_version >>-{{ checksum "creditsafe.gemspec" }}-{{ checksum "Gemfile" }} + + steps: &steps + - checkout + - *restore_bundle + - *bundle_install + - *cache_bundle + - run: + name: Run specs + command: | + circleci tests glob "spec/**/*_spec.rb" + bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) --profile --format progress --format RspecJunitFormatter -o /tmp/circle_artifacts/rspec.xml + - run: + name: "Rubocop" + command: bundle exec rubocop --extra-details --display-style-guide --parallel --force-exclusion + - store_artifacts: + path: /tmp/circle_artifacts/ + - store_test_results: + path: /tmp/circle_artifacts/ + + ruby_versions: &ruby_versions + - "2.7" + - "3.0" + jobs: - build: - working_directory: ~/creditsafe-ruby + test_and_lint: + working_directory: /mnt/ramdisk + parameters: + ruby_version: + type: string docker: - - image: ruby:2.5 - steps: - - checkout - - restore_cache: - key: bundler-v1-{{ checksum "creditsafe.gemspec" }}-{{ checksum ".ruby-version" }} - - run: bundle install --path vendor/bundle - - save_cache: - key: bundler-v1-{{ checksum "creditsafe.gemspec" }}-{{ checksum ".ruby-version" }} - paths: - - "vendor/bundle" - - run: bundle exec rubocop - - run: bundle exec rspec --format RspecJunitFormatter + - image: cimg/ruby:<< parameters.ruby_version >> + environment: + CIRCLE_TEST_REPORTS: /tmp/circle_artifacts/ + steps: *steps + +workflows: + version: 2 + tests: + jobs: + - test_and_lint: + matrix: + parameters: + ruby_version: *ruby_versions