forked from platanus/fdbk-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
178 lines (150 loc) · 5.47 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
version: 2.1
ruby-image: &ruby-image cimg/ruby:2.7
postgres-image: &postgres-image postgres:11.3
redis-image: &redis-image redis
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
- image: *postgres-image
- image: *redis-image
lint-executor:
docker:
- image: *ruby-image
environment: *env-vars
commands:
setup:
description: checkout code, restore cache, install dependencies, save cache
steps:
- checkout
- restore_cache:
keys:
- bundle-dependencies-{{ .Environment.BUNDLE_CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}
- bundle-dependencies-
- restore_cache:
keys:
- 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
- run:
name: Install yarn dependencies
command: |
curl -sL https://deb.nodesource.com/setup_$(cat .node-version).x | sudo -E bash -
sudo apt-get install -y nodejs
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-{{ .Environment.BUNDLE_CACHE_VERSION }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- save_cache:
key: yarn-dependencies-{{ .Environment.YARN_CACHE_VERSION }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: Install apt and vips buildpack dependencies
command: |
xargs -a Aptfile sudo apt-get install
sudo apt-get install libvips
jobs:
test:
executor: test-executor
steps:
- setup
- browser-tools/install-chrome:
chrome-version: 114.0.5735.90
- browser-tools/install-chromedriver
- run:
name: Wait for redis service
command: dockerize -wait tcp://localhost:6379 -timeout 1m
- run:
name: Wait for postgres service
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Setup database
command: bundle exec rails db:create db:schema:load
- run:
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 simplecov
shell: /bin/bash
command: |
cat coverage/coverage.txt | ./bin/reviewdog -reporter=github-pr-review -efm="%f:%l:%c: %m"
- 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 jest
command: |
yarn run test > coverage/input_jest.txt
touch coverage/output_jest.txt
./node_modules/.bin/format-coverage coverage/input_jest.txt coverage/output_jest.txt /home/circleci/project/app/javascript
cat coverage/output_jest.txt | ./bin/reviewdog -reporter=github-pr-review -efm="%f:%l:%c: %m"
- store_test_results:
path: test_results
lint:
executor: lint-executor
steps:
- setup
- run:
name: Get files to lint
command: git diff origin/master --name-only --diff-filter=d > tmp/files_to_lint
- run:
name: Run rubocop
shell: /bin/bash
command: |
cat tmp/files_to_lint | grep -E '.+\.(rb)$' | xargs bundle exec rubocop --force-exclusion \
| ./bin/reviewdog -reporter=github-pr-review -f=rubocop
- run:
name: Run eslint
shell: /bin/bash
command: |
cat tmp/files_to_lint | grep -E '.+\.(js|jsx|vue)$' | xargs yarn run eslint \
| ./bin/reviewdog -reporter=github-pr-review -f=eslint
- run:
name: Run tsc
shell: /bin/bash
command: |
yarn run tsc --noEmit | ./bin/reviewdog -reporter=github-pr-review -f=tsc
- run:
name: Run vue-tsc
shell: /bin/bash
command: |
yarn run vue-tsc --noEmit | ./bin/reviewdog -reporter=github-pr-review -f=tsc
- run:
name: Run stylelint
shell: /bin/bash
command: |
cat tmp/files_to_lint | grep -E '.+\.(scss|css|less)$' | xargs yarn run stylelint \
| ./bin/reviewdog -reporter=github-pr-review -f=stylelint
workflows:
test_and_lint:
jobs:
- test:
context: org-global
- lint:
context: org-global