forked from dockstore/dockstore-ui2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
411 lines (407 loc) · 14.4 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
version: 2.1
orbs:
aws-s3: circleci/[email protected]
slack: circleci/[email protected]
executors:
integration_test_exec: # declares a reusable executor
docker:
- image: circleci/buildpack-deps:18.04-browsers
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
environment:
JAVA_TOOL_OPTIONS: -Xmx2g # Java can read cgroup. Sadly the cgroup in CircleCI is wrong. Have to manually set. Using 1/2 memory as heap.
- image: circleci/postgres:11.6-alpine-ram
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
jobs:
# Specify the webpage url (https://dev.dockstore.net or https://staging.dockstore.org or https://dockstore.org)
# and stack (dev or staging or prod) and the no auth smoke tests will be run against the corresponding webpage.
uptime_monitor_no_auth:
parameters:
stack:
type: string
working_directory: ~/repo
docker:
- image: circleci/buildpack-deps:18.04-browsers
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
steps:
- setup_nightly_tests
- run:
name: Run remote verification test against << parameters.stack >> (no auth)
command: bash -i -c 'npm run test-<< parameters.stack >>-no-auth'
environment:
MOCHA_FILE: nightly-test-results/junit/test-<< parameters.stack >>-no-auth-[hash].xml
- run:
name: Run remote verification of WAF against << parameters.stack >>
command: bash -i -c 'npm run test-<< parameters.stack >>-waf'
environment:
MOCHA_FILE: nightly-test-results/junit/test-<< parameters.stack >>-waf-[hash].xml
- upload_nightly_artifacts
- slack/status:
fail_only: true
failure_message: Nightly << parameters.stack >> non-auth tests failed!
webhook: $SLACK_WEBHOOK
# Specify the webpage url (https://dev.dockstore.net or https://staging.dockstore.org or https://dockstore.org)
# and stack (dev or staging or prod) and the no auth smoke tests will be run against the corresponding webpage.
uptime_monitor_auth:
parameters:
stack:
type: string
working_directory: ~/repo
docker:
- image: circleci/buildpack-deps:18.04-browsers
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
steps:
- setup_nightly_tests
- run:
name: Run remote verification test against << parameters.stack >> (with auth)
command: bash -i -c 'npm run test-<< parameters.stack >>-auth'
environment:
MOCHA_FILE: nightly-test-results/junit/test-<< parameters.stack >>-auth-[hash].xml
- upload_nightly_artifacts
- slack/status:
fail_only: true
failure_message: Nightly << parameters.stack >> auth tests failed!
webhook: $SLACK_WEBHOOK
lint_license_unit_test_coverage:
working_directory: ~/repo
docker:
- image: circleci/buildpack-deps:18.04-browsers
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
steps:
- checkout
- run:
name: Checkout merge commit (PRs only)
command: |
if [[ -n "${CIRCLE_PULL_REQUEST}" ]]
then
git fetch origin +refs/pull/${CIRCLE_PULL_REQUEST##*/}/merge:
git checkout -qf FETCH_HEAD
fi
- install_container_dependencies
- restore_cache:
key: dep-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
- run:
name: Install dependencies
#Only run 'npm ci' if node_modules was not restored from cache
command: |
if [ ! -d "./node_modules" ]
then
bash -i -c 'npm ci'
fi
- save_cache:
key: dep-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
paths:
- ./node_modules
- save_cache:
key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
paths:
- ~/.cache
# Disabled until ng2-ui-auth and @ngx-lite/json is replaced. Currently they do not support Angular 9
# - run:
# name: Check dependencies
# command: bash -i -c 'npm ls'
- run:
name: Lint
command: bash -i -c 'npm run lint'
- run:
name: License Test
command: |
bash -i -c 'npm run circle-ci-license-test-file'
bash scripts/detect-package-json-changes.sh
- run:
name: Build
command: NODE_OPTIONS="--max-old-space-size=1610" bash -i -c 'npm run build.prod'
- run:
name: Install codecov
command: bash -i -c 'npm i --no-save codecov'
- run:
name: Unit Test
command: bash -i -c 'npx ng test --progress=false --watch=false --code-coverage --browsers ChromeHeadless --source-map=false'
- run:
name: Codecov
command: bash -i -c 'npx codecov'
- persist_to_workspace:
root: .
paths:
- .
integration_test_1:
executor: integration_test_exec
working_directory: ~/repo
steps:
- setup_integration_test
- restore_cache:
key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
- run:
name: Test
command: bash -i -c 'npx cypress run --record --config numTestsKeptInMemory=1 --reporter junit --spec cypress/integration/group1/**/*'
environment:
MOCHA_FILE: integration-tests/test-results/junit/test-results-[hash].xml
when: always
- upload_artifacts
integration_test_2:
executor: integration_test_exec
working_directory: ~/repo
steps:
- setup_integration_test
- restore_cache:
key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
- run:
name: Test
command: bash -i -c 'npx cypress run --record --config numTestsKeptInMemory=1 --reporter junit --spec cypress/integration/group2/**/*'
environment:
MOCHA_FILE: integration-tests/test-results/junit/test-results-[hash].xml
when: always
- upload_artifacts
integration_test_3:
executor: integration_test_exec
working_directory: ~/repo
steps:
- setup_integration_test
- restore_cache:
key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
- run:
name: Test
command: bash -i -c 'npx cypress run --record --config numTestsKeptInMemory=1 --reporter junit --spec cypress/integration/immutableDatabaseTests/**/*'
environment:
MOCHA_FILE: integration-tests/test-results/junit/test-results-[hash].xml
when: always
- upload_artifacts
upload_to_s3:
working_directory: ~/repo
docker:
- image: circleci/python:2.7
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
parameters:
aws_bucket:
type: string
default: "${AWS_BUCKET}"
steps:
- when:
condition: <<parameters.aws_bucket>>
steps:
- get_workspace
- install_container_dependencies
# Build again for the upload to s3
# TODO: https://gui.dockstore.org/${CIRCLE_TAG:-$CIRCLE_BRANCH}-$(echo $CIRCLE_SHA1 | cut -c -7) can probably be made into a bash/circle-ci variable.
- run:
name: Swap for CDN paths
command: bash -i -c "find src \( -iname '*.html' -o -iname '*.ts' -o -iname '*.json' \) -exec sed -i 's~\(\.\./\)\+assets/~https://gui\.dockstore\.org/${CIRCLE_TAG:-$CIRCLE_BRANCH}-$(echo $CIRCLE_SHA1 | cut -c -7)/assets/~g' {} +"
- run:
name: Build
command: NODE_OPTIONS="--max-old-space-size=1610" bash -i -c 'npm run build.prod -- --deploy-url https://gui.dockstore.org/${CIRCLE_TAG:-$CIRCLE_BRANCH}-$(echo $CIRCLE_SHA1 | cut -c -7)/'
# Copy to a versioned folder
- aws-s3/copy:
from: dist
to: 's3://${AWS_BUCKET}/${CIRCLE_TAG:-$CIRCLE_BRANCH}-$(echo $CIRCLE_SHA1 | cut -c -7)'
arguments: |
--recursive \
--exclude index.html
- aws-s3/copy:
from: dist/index.html
to: 's3://${AWS_BUCKET}/${CIRCLE_TAG-$CIRCLE_BRANCH}-$(echo $CIRCLE_SHA1 | cut -c -7)/index.html'
arguments: |
--cache-control max-age=0
check_build_develop:
working_directory: ~/repo
docker:
- image: circleci/python:2.7
auth:
username: dockstoretestuser
password: $DOCKERHUB_PASSWORD
steps:
- get_workspace
- install_container_dependencies
# Override the webservice version in package.json to instead build against develop webservice
- run:
name: set webservice to develop
command: bash -i -c 'npm config set dockstore-ui2:webservice_version develop'
- run:
name: Build
command: NODE_OPTIONS="--max-old-space-size=1610" bash -i -c 'npm run build.prod'
workflows:
version: 2
everything:
jobs:
# # Add the tags filter to all jobs so they will run before upload_to_s3
- lint_license_unit_test_coverage:
filters:
tags:
only: /.*/
context:
- dockerhub
- integration_test_1:
filters:
tags:
only: /.*/
requires:
- lint_license_unit_test_coverage
context:
- dockerhub
- integration_test_2:
filters:
tags:
only: /.*/
requires:
- lint_license_unit_test_coverage
context:
- dockerhub
- integration_test_3:
filters:
tags:
only: /.*/
requires:
- lint_license_unit_test_coverage
context:
- dockerhub
# Upload builds for tags and branches to s3.
- upload_to_s3:
requires:
- integration_test_1
- integration_test_2
- integration_test_3
filters:
tags:
only: /.*/
branches:
only: /.*/
context:
- dockerhub
- check_build_develop:
requires:
- upload_to_s3
filters:
branches:
only: /^develop/
context:
- dockerhub
nightly:
triggers:
- schedule:
cron: "0 11 * * *" # This is 4am PDT / 3am PST
filters:
branches:
only:
- develop
jobs:
- uptime_monitor_no_auth:
name: "uptime_monitor_no_auth-dev"
stack: "dev"
context:
- dockerhub
- uptime_monitor_no_auth:
name: "uptime_monitor_no_auth-staging"
stack: "staging"
context:
- dockerhub
# - uptime_monitor_no_auth:
# name: "uptime_monitor_no_auth-prod"
# stack: "prod"
# context:
# - dockerhub
# TODO: Add auth tests for staging/prod once https://ucsc-cgl.atlassian.net/browse/SEAB-2071 is done.
- uptime_monitor_auth:
stack: "dev"
context:
- dockerhub
commands:
install_container_dependencies:
steps:
- run:
name: Install java
command: |
sudo apt update -y
sudo apt install openjdk-11-jre -yq
- run:
name: Install npm
command: |
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
bash -i -c 'nvm install'
get_workspace:
steps:
- attach_workspace:
at: .
upload_artifacts:
steps:
- store_test_results:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-results
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots
setup_integration_test:
steps:
- get_workspace
- install_container_dependencies
- run:
name: Install postgresql client
command: sudo apt install -y postgresql-client || true
- run:
name: Install cypress dependencies
command: sudo apt install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb -yq
- run:
name: Prepare webservice
command: bash -i -c 'npm run webservice'
- run:
name: Install nginx
command: sudo apt install -y nginx || true
- run:
name: Prepapre nginx config
command: sed "s%REPLACEME%`pwd`%" .circleci/nginx.conf.tmpl > .circleci/nginx.conf
- run:
name: Run nginx
command: sudo nginx -c `pwd`/.circleci/nginx.conf
background: true
- run:
name: Run webservice
command: java -jar dockstore-webservice.jar server travisci/web.yml 1>/dev/null
background: true
- run: mkdir -p integration-tests/test-results/junit
- run:
name: Wait for services
command: bash scripts/wait-for.sh
setup_nightly_tests:
steps:
- checkout
- install_container_dependencies
- restore_cache:
key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "./package-lock.json" }}
- run:
name: Install dependencies
#Only run 'npm ci' if node_modules was not restored from cache
command: |
if [ ! -d "./node_modules" ]
then
bash -i -c 'npm ci'
fi
mkdir -p nightly-test-results/junit
- run:
name: Prebuild
command: bash -i -c 'npm run prebuild.prod'
upload_nightly_artifacts:
steps:
- store_test_results:
path: nightly-test-results/
- store_artifacts:
path: nightly-test-results/
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots