11version : 2.1
2+
3+ env-vars : &env-vars
4+ RAILS_ENV : test
5+ NODE_ENV : test
6+ BUNDLE_PATH : vendor/bundle
7+ SPROCKETS : false
8+
29orbs :
310 ruby : circleci/ruby@0.1.2
411 browser-tools : circleci/browser-tools@1.1.3
5- jobs :
6- test :
12+
13+ executors :
14+ main-executor :
715 parameters :
816 ruby-version :
17+ description : " Ruby version"
18+ default : " 2.7"
919 type : string
1020 docker :
11- - image : circleci/ruby:<< parameters.ruby-version >>-node
12- environment :
13- RAILS_ENV : test
14- NODE_ENV : test
15- BUNDLE_PATH : vendor/bundle
16- SPROCKETS : false
17- executor : ruby/default
21+ - image : circleci/ruby:<<parameters.ruby-version>>-node
22+ environment : *env-vars
23+
24+ commands :
25+ setup :
26+ description : checkout code, restore cache, install dependencies, save cache
1827 steps :
1928 - checkout
2029 - browser-tools/install-chrome
4150 command : |
4251 bundle exec rake prepare_assets
4352 (cd spec/dummy && bundle exec rake webpacker:compile)
53+
54+ jobs :
55+ lint :
56+ executor : main-executor
57+ steps :
58+ - setup
4459 - run :
45- name : Utils Tests
60+ name : Install reviewdog
61+ command : |
62+ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ./bin
63+ - run :
64+ name : Get files to lint
65+ command : git diff origin/master --name-only --diff-filter=d > tmp/files_to_lint
66+ - run :
67+ name : Run rubocop
68+ shell : /bin/bash
69+ command : |
70+ cat tmp/files_to_lint | grep -E '.+\.(rb)$' | xargs bundle exec rubocop --force-exclusion \
71+ | ./bin/reviewdog -reporter=github-pr-review -f=rubocop
72+ test :
73+ parameters :
74+ ruby-version :
75+ description : " Ruby version"
76+ default : " 2.7"
77+ type : string
78+ executor :
79+ name : main-executor
80+ ruby-version : <<parameters.ruby-version>>
81+ steps :
82+ - setup
83+ - run :
84+ name : Run Utils Tests
4685 command : |
4786 RSPEC_JUNIT_ARGS="-r rspec_junit_formatter -f RspecJunitFormatter -o test_results/utils-rspec.xml"
4887 RSPEC_FORMAT_ARGS="-f progress --no-color -p 10"
@@ -63,10 +102,13 @@ jobs:
63102 bundle exec rspec ./spec/features $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
64103 - store_test_results :
65104 path : test_results
105+
66106workflows :
67107 version : 2
68- test :
108+ test_and_lint :
69109 jobs :
110+ - lint :
111+ context : org-global
70112 - test :
71113 matrix :
72114 parameters :
0 commit comments