-
Notifications
You must be signed in to change notification settings - Fork 23
/
config.yml
245 lines (230 loc) · 5.79 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
242
243
244
245
version: 2.1
# We still use this legacy machine executor for building docker images.
# TODO: use docker executor and setup_remote_docker for these builds.
defaults: &defaults
machine:
image: ubuntu-2204:current
working_directory: ~/repo
environment:
LEIN_ROOT: "true"
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
orbs:
browser-tools: circleci/[email protected]
executors:
clojure:
docker:
- image: cimg/clojure:1.11.1-browsers
db:
docker:
- image: cimg/clojure:1.11.1-browsers
- image: postgres:13
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: rems_test
jobs:
deps:
executor: clojure
resource_class: large
steps:
- checkout
- restore_cache:
keys:
- &cache-key v4-dependencies-{{ checksum "project.clj" }}-{{ checksum "package-lock.json" }}-{{ checksum "shadow-cljs.edn" }}
# fallback to using the latest cache if no exact match is found
- v4-dependencies-
# shadow-build installs npm packages, builds shadow-cljs app and caches maven deps as well
- run: lein do deps, shadow-build
- save_cache:
paths:
- ~/.m2
- node_modules
key: *cache-key
# persist shadow-cljs build for browser tests etc
- persist_to_workspace:
root: .
paths:
- target/shadow
- .shadow-cljs
unit-test:
executor: clojure
steps:
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- checkout
- attach_workspace:
at: .
- restore_cache:
key: *cache-key
# verify that we can run unit tests without the database:
- run: DATABASE_URL=invalid lein kaocha --reporter kaocha.report/documentation unit
- run: npm run shadow-test # skips installing npm dependencies as they are already in workspace
- store_test_results:
path: target/test-results
cljfmt:
executor: clojure
steps:
- checkout
- restore_cache:
key: *cache-key
- run: lein cljfmt check
integration-test:
executor: db
steps:
- checkout
- restore_cache:
key: *cache-key
- run: lein kaocha --reporter kaocha.report/documentation integration
- store_test_results:
path: target/test-results
browser-test:
executor: db
resource_class: large
parallelism: 4
steps:
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- checkout
# include shadow-cljs build
- attach_workspace:
at: .
- restore_cache:
key: *cache-key
- run: lein kaocha --reporter kaocha.report/documentation --plugin rems.kaocha-circleci/plugin browser
- store_test_results:
path: target/test-results
- store_artifacts:
path: browsertest-errors
- store_artifacts:
path: browsertest-downloads
- store_artifacts:
path: browsertest-accessibility-report
build:
executor: clojure
steps:
- checkout
- restore_cache:
key: *cache-key
- run: lein with-profile uberjar uberjar # fix a bug in leiningen 2.9.9-2.9.10, fix in 2.9.11
- store_artifacts:
path: target/uberjar/rems.jar
- persist_to_workspace:
root: .
paths:
- target/uberjar/rems.jar
docker-snapshot:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run: .circleci/docker.sh circle
docker-release:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run: .circleci/docker.sh release
rahti-dev:
<<: *defaults
steps:
- checkout
- run: .circleci/rahti-deploy.sh dev
rahti-demo:
<<: *defaults
steps:
- checkout
- run: .circleci/rahti-deploy.sh demo
# pseudo job to post a single ok status to github after all the tests
ok:
docker:
- image: alpine
steps:
- run: 'true'
workflows:
version: 2
build-test-and-deploy:
jobs:
- deps:
filters:
tags:
only: /.*/
- unit-test:
requires:
- deps
filters:
tags:
only: /.*/
- integration-test:
requires:
- deps
filters:
tags:
only: /.*/
- browser-test:
requires:
- deps
filters:
tags:
only: /.*/
- cljfmt:
filters:
tags:
only: /.*/
- build:
requires:
- deps
filters:
tags:
only: /.*/
branches:
only:
- master
- docker-snapshot:
requires:
- deps
- build
filters:
branches:
only:
- master
- docker-release:
requires:
- deps
- build
filters:
tags:
only: /v[0-9]\.[0-9].*/
branches:
ignore: /.*/
- rahti-dev:
requires:
- deps
- build
- docker-snapshot
filters:
branches:
only:
- master
- rahti-demo:
requires:
- deps
- build
- docker-release
filters:
tags:
only: /v[0-9]\.[0-9].*/
branches:
ignore: /.*/
- ok:
requires:
- deps
- unit-test
- integration-test
- browser-test
- build
- cljfmt
filters:
tags:
only: /.*/