-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfig.yml
241 lines (239 loc) · 8.33 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
---
version: 2.1
orbs:
slack: circleci/[email protected]
executors:
ruby_executor:
working_directory: /mnt/ramdisk
docker:
- image: cimg/ruby:3.2.2-browsers
rails_executor:
working_directory: /mnt/ramdisk
docker:
- image: cimg/ruby:3.2.2-browsers
environment:
PGHOST: 127.0.0.1
PGUSER: root
- image: cimg/postgres:13.4-postgis
environment:
POSTGRES_USER: root
POSTGRES_DB: circle-test_test
POSTGRES_HOST_AUTH_METHOD: trust
command: postgres -c 'fsync=false' -c 'synchronous_commit=off'
resource_class: xlarge
commands:
install_system_dependencies:
description: "Install system dependencies"
steps:
- run:
# Run apt update with --allow-releaseinfo-change because the CircleCI environment is based on Debian buster, which used to be called stable Debian, but is now called oldstable
name: install system dependencies
command: |
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update --allow-releaseinfo-change
- run:
name: install pdftk-java
command: ./vendor/pdftk/install
install_js_dependencies:
description: "Install JS dependencies"
steps:
- restore_cache:
key: yarn-{{ checksum "yarn.lock" }}
- run:
name: yarn install --frozen-lockfile
command: yarn install --frozen-lockfile
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- /mnt/ramdisk/node_modules
- ~/.npm
install_ruby_dependencies:
description: "Install Ruby dependencies"
steps:
- restore_cache:
key: bundle-{{ checksum "Gemfile.lock" }}
- run:
name: install bundler & ruby dependencies
command: |
gem install bundler:2.3.5 --no-document && \
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
key: bundle-{{ checksum "Gemfile.lock" }}
paths: [/mnt/ramdisk/vendor/bundle]
install_efile_schemas:
description: "Install IRS e-File schemas"
steps:
- restore_cache:
key: bundle-{{ checksum "app/lib/schema_file_loader.rb" }}-{{ checksum "app/services/state_file/state_information_service.rb" }}-v2
- run: if [ ! -d vendor/irs/unpacked ] ; then bundle exec rails setup:download_efile_schemas setup:unzip_efile_schemas ; fi && find vendor/irs && find vendor/us_states
- save_cache:
key: bundle-{{ checksum "app/lib/schema_file_loader.rb" }}-{{ checksum "app/services/state_file/state_information_service.rb" }}-v2
paths:
- /mnt/ramdisk/vendor/irs
- /mnt/ramdisk/vendor/us_states
setup_test_db_for_parallel:
description: "Setup test database"
steps:
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: bundle exec rake db:create db:schema:load parallel:create[12] parallel:prepare[12]
setup_test_db:
description: "Setup test database"
steps:
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: bundle exec rake db:create db:schema:load
setup_webdriver:
description: Install Ruby webdriver
steps:
- run: date -I > /tmp/today && cat /tmp/today
- restore_cache:
key: webdrivers-v3-{{ checksum "/tmp/today" }}
- run: bin/gyr download_webdriver
- save_cache:
key: webdrivers-v3-{{ checksum "/tmp/today" }}
paths: [~/.cache/selenium]
jobs:
i18n_normalize:
executor: ruby_executor
steps:
- checkout
- install_ruby_dependencies
- run: bundle exec i18n-tasks normalize
- run: git config --global user.name CircleCI && git config --global user.email [email protected]
- add_ssh_keys:
fingerprints:
- "SHA256:EXWjLe9Ii75NBbYkzOBWosq89GW7n7XuIiTovZoPZPk"
- run: git diff --quiet || (git commit -am "Run i18n-tasks normalize" && git push origin translations_a24d8971fccee9a494b7267ce7f7deae_es)
run_js_tests:
executor: ruby_executor
steps:
- checkout
- install_js_dependencies
- run: mkdir ~/test-results && mkdir ~/test-results/rspec && mkdir ~/test-results/jest
- run:
command: npm test --ci --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT_DIR: ./test-results/jest/
- store_test_results:
path: ~/test-results
- slack/notify:
branch_pattern: main, fake-main-for-testing, release
event: fail
mentions: "@badger"
template: basic_fail_1
run_annotate:
executor: rails_executor
steps:
- checkout
- install_ruby_dependencies
- setup_test_db
- run: bundle exec annotate --frozen
run_ruby_tests:
executor: rails_executor
steps:
- checkout
- install_js_dependencies
- install_system_dependencies
- install_ruby_dependencies
- install_efile_schemas
- setup_test_db_for_parallel
- setup_webdriver
- restore_cache:
key: parallel-runtime-{{ checksum "/tmp/today" }}
- run: RAILS_ENV=test bin/shakapacker
- run:
command: bundle exec parallel_rspec -n 12 || touch /tmp/re-run
environment:
EAGER_LOAD: 1
RAILS_CACHE_CLASSES: 1
- run:
command: |
if [ -f /tmp/re-run ] ; then TEST_FILE_PREFIX=retry_ EAGER_LOAD=1 RAILS_CACHE_CLASSES=1 bundle exec parallel_rspec -n 12 -- --only-failures -- ; fi
- store_test_results:
path: tmp/rspec-parallel-test-results
- store_artifacts:
path: /tmp/failure_screenshots
- save_cache:
key: parallel-runtime-{{ checksum "/tmp/today" }}
paths: [tmp/parallel_runtime_rspec.log]
- slack/notify:
branch_pattern: main, fake-main-for-testing, release
event: fail
mentions: "@badger"
template: basic_fail_1
flow_explorer_screenshots:
executor: rails_executor
steps:
- checkout
- install_js_dependencies
- install_system_dependencies
- install_ruby_dependencies
- install_efile_schemas
- setup_test_db
- run: bundle exec rake assets:precompile
- run: bundle exec rake flow_explorer:capture_screenshots flow_explorer:upload_screenshots
deploy_to_aptible--demo:
executor: ruby_executor
steps:
- checkout
- run: echo $APTIBLE_PUBLIC_KEY >> ~/.ssh/known_hosts
- run: git fetch --depth=1000000
- run: git push [email protected]:vita-min-demo/vita-min-demo.git $CIRCLE_SHA1:master
parallelism: 1
deploy_to_aptible--staging:
executor: ruby_executor
steps:
- checkout
- run: echo $APTIBLE_PUBLIC_KEY >> ~/.ssh/known_hosts
- run: git fetch --depth=1000000
- run: git push --force [email protected]:vita-min-staging/vita-min-staging.git $CIRCLE_SHA1:master
parallelism: 1
deploy_to_aptible--production:
executor: ruby_executor
steps:
- checkout
- run: echo $APTIBLE_PUBLIC_KEY >> ~/.ssh/known_hosts
- run: git fetch --depth=1000000
- run: git push [email protected]:vita-min-prod/vita-min-prod.git $CIRCLE_SHA1:master
parallelism: 1
workflows:
version: 2
ci-and-deploy:
jobs:
- i18n_normalize:
filters:
branches:
only: translations_a24d8971fccee9a494b7267ce7f7deae_es
- run_js_tests:
context: gyr_deploy_alerts
- run_ruby_tests:
context: gyr_deploy_alerts
- run_annotate
- deploy_to_aptible--demo:
requires: [run_js_tests, run_ruby_tests]
filters:
branches:
only: main
- deploy_to_aptible--staging:
requires: [run_js_tests, run_ruby_tests]
filters:
branches:
only: staging
- flow_explorer_screenshots:
filters:
branches:
only: [circleci-update-flow-explorer-screenshots]
- deploy_to_aptible--production:
requires: [run_js_tests, run_ruby_tests]
filters:
branches:
only: release
# daily:
# triggers:
# - schedule:
# cron: "19 0 * * *"
# filters:
# branches:
# only:
# - main
# jobs:
# - flow_explorer_screenshots