lib/potassium/assets/.circleci/config.yml.erb in potassium-6.4.0 vs lib/potassium/assets/.circleci/config.yml.erb in potassium-6.5.0
- old
+ new
@@ -1,8 +1,8 @@
version: 2.1
-ruby-image: &ruby-image circleci/ruby:<%= ruby_version %>
+ruby-image: &ruby-image cimg/ruby:<%= ruby_version %>
<%- if selected?(:database, :postgresql) -%>
postgres-image: &postgres-image postgres:<%= Potassium::POSTGRES_VERSION %>
<%- end -%>
<%- if selected?(:background_processor) -%>
redis-image: &redis-image redis
@@ -10,10 +10,13 @@
env-vars: &env-vars
BUNDLE_JOBS: 4
BUNDLE_PATH: vendor/bundle
RAILS_ENV: test
+orbs:
+ browser-tools: circleci/browser-tools@1.1
+
executors:
test-executor:
docker:
- image: *ruby-image
environment: *env-vars
@@ -35,19 +38,24 @@
steps:
- checkout
- restore_cache:
keys:
- - bundle-dependencies-{{ checksum "Gemfile.lock" }}
+ - bundle-dependencies-{{ .Environment.BUNDLE_CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}
- bundle-dependencies-
- restore_cache:
keys:
- - yarn-dependencies-{{ checksum "yarn.lock" }}
+ - yarn-dependencies-{{ .Environment.YARN_CACHE_VERSION }}-{{ checksum "yarn.lock" }}
- yarn-dependencies-
- run:
+ name: Install reviewdog
+ command: |
+ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ./bin
+
+ - run:
name: Install bundle dependencies
command: |
BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")
gem install bundler:$BUNDLER_VERSION
bundle _$(echo $BUNDLER_VERSION)_ install
@@ -60,24 +68,26 @@
curl -o- -sL https://yarnpkg.com/install.sh | bash
sudo ln -s $HOME/.yarn/bin/yarn /usr/local/bin/yarn
yarn install --frozen-lockfile
- save_cache:
- key: bundle-dependencies-{{ checksum "Gemfile.lock" }}
+ key: bundle-dependencies-{{ .Environment.BUNDLE_CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- save_cache:
- key: yarn-dependencies-{{ checksum "yarn.lock" }}
+ key: yarn-dependencies-{{ .Environment.YARN_CACHE_VERSION }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
jobs:
test:
executor: test-executor
steps:
- setup
+ - browser-tools/install-chrome
+ - browser-tools/install-chromedriver
<%- if selected?(:background_processor) -%>
- run:
name: Wait for redis service
command: dockerize -wait tcp://localhost:6379 -timeout 1m
@@ -91,16 +101,29 @@
name: Setup database
command: bundle exec rails db:create db:schema:load
<%- end -%>
- run:
- name: Run rspec
+ name: Run RSpec unit tests
command: |
RSPEC_JUNIT_ARGS="-r rspec_junit_formatter -f RspecJunitFormatter -o test_results/rspec.xml"
RSPEC_FORMAT_ARGS="-f progress --no-color -p 10"
bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
+ - run:
+ name: Run RSpec system tests
+ command: |
+ RSPEC_JUNIT_ARGS="-r rspec_junit_formatter -f RspecJunitFormatter -o test_results/rspec-system.xml"
+ RSPEC_FORMAT_ARGS="--tag type:system -f progress --no-color -p 10"
+ bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
+
+ - run:
+ name: Run simplecov
+ shell: /bin/bash
+ command: |
+ cat coverage/coverage.txt | ./bin/reviewdog -reporter=github-pr-review -efm="%f:%l:%c: %m"
+
<%- if selected?(:front_end, :vue) -%>
- run:
name: Run jest
command: yarn run test
<%- end -%>
@@ -110,14 +133,9 @@
lint:
executor: lint-executor
steps:
- setup
-
- - run:
- name: Install reviewdog
- command: |
- curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ./bin
- run:
name: Get files to lint
command: git diff origin/master --name-only --diff-filter=d > tmp/files_to_lint