@@ -223,6 +223,134 @@ jobs:
223
223
DOCKER_IMAGE_SESSION_SERVICE : cbioportal/session-service:0.5.0
224
224
FRONTEND_TEST_DO_NOT_LOAD_EXTERNAL_FRONTEND : true
225
225
226
+ pull_cbioportal_test_codebase :
227
+ machine :
228
+ image : ubuntu-2204:2024.08.1
229
+ resource_class : medium
230
+ working_directory : /tmp/repos
231
+ steps :
232
+ - run :
233
+ name : Checkout cbioportal/cbioportal-test
234
+ environment :
235
+ TEST_REPO_URL : https://github.com/cBioPortal/cbioportal-test
236
+ command : |
237
+ git clone ${TEST_REPO_URL}
238
+ - persist_to_workspace :
239
+ root : /tmp/repos
240
+ paths :
241
+ - cbioportal-test
242
+
243
+ pull_cbioportal_frontend_codebase :
244
+ machine :
245
+ image : ubuntu-2204:2024.08.1
246
+ resource_class : medium
247
+ working_directory : /tmp/repos
248
+ steps :
249
+ - run :
250
+ name : Checkout cbioportal/cbioportal-frontend
251
+ environment :
252
+ FRONTEND_REPO_URL : https://github.com/cBioPortal/cbioportal-frontend.git
253
+ FRONTEND_REPO_BRANCH : master
254
+ command : |
255
+ git clone -b ${FRONTEND_REPO_BRANCH} --single-branch ${FRONTEND_REPO_URL}
256
+ - persist_to_workspace :
257
+ root : /tmp/repos
258
+ paths :
259
+ - cbioportal-frontend
260
+
261
+ build_push_image :
262
+ machine :
263
+ image : ubuntu-2204:2024.08.1
264
+ resource_class : medium
265
+ working_directory : /tmp/repos
266
+ steps :
267
+ - attach_workspace :
268
+ at : /tmp/repos
269
+ - checkout :
270
+ path : /tmp/repos/cbioportal
271
+ - run :
272
+ name : Build cBioPortal docker image
273
+ environment :
274
+ DOCKER_REPO : cbioportal/cbioportal-dev
275
+ command : |
276
+ export DOCKER_TAG=$CIRCLE_SHA1
277
+ URL="https://hub.docker.com/v2/repositories/cbioportal/cbioportal-dev/tags/$DOCKER_TAG-web-shenandoah"
278
+ TAG_FOUND=$(curl -s $URL | jq -r .name)
279
+ if [ $TAG_FOUND = "$DOCKER_TAG-web-shenandoah" ]; then
280
+ echo "Image already exists. Skipping build step!"
281
+ exit 0
282
+ fi
283
+ cd cbioportal-test
284
+ ./scripts/build-push-image.sh --src=/tmp/repos/cbioportal --push=true --skip_web_and_data=true
285
+ EXISTS=$(docker manifest inspect $DOCKER_REPO:$DOCKER_TAG-web-shenandoah > /dev/null; echo $?)
286
+ if [ $EXISTS -eq 0 ]; then
287
+ echo "Build succeeded!"
288
+ else
289
+ echo "Build failed!"
290
+ exit 1
291
+ fi
292
+
293
+ run_api_tests :
294
+ machine :
295
+ image : ubuntu-2204:2024.08.1
296
+ docker_layer_caching : true
297
+ resource_class : large
298
+ working_directory : /tmp/repos
299
+ steps :
300
+ - attach_workspace :
301
+ at : /tmp/repos
302
+ - checkout :
303
+ path : /tmp/repos/cbioportal
304
+ - run :
305
+ name : Instantiate a cbioportal instance
306
+ environment :
307
+ DOCKER_REPO : cbioportal/cbioportal-dev
308
+ APP_CLICKHOUSE_MODE : " true"
309
+ command : |
310
+ cd cbioportal-test
311
+ export DOCKER_IMAGE_CBIOPORTAL=$DOCKER_REPO:$CIRCLE_SHA1-web-shenandoah
312
+ nohup ./scripts/docker-compose.sh >> /tmp/repos/docker-compose-logs.txt 2>&1 &
313
+ - run :
314
+ name : Wait for cbioportal to be live at localhost
315
+ command : |
316
+ cd cbioportal-test
317
+ ./utils/check-connection.sh --url=localhost:8080
318
+ - run :
319
+ name : Confirm cbioportal config matches PR
320
+ command : |
321
+ cd cbioportal
322
+ echo "Matching gitCommitId..."
323
+ INSTANCE_COMMIT_ID=$(curl -s http://localhost:8080/api/info | jq -r '.["gitCommitId"]')
324
+ PR_COMMIT_ID=$CIRCLE_SHA1
325
+ if [ "$INSTANCE_COMMIT_ID" = "$PR_COMMIT_ID" ]; then
326
+ echo "gitCommitId successfully matched!"
327
+ echo "cBioPortal is ready:"
328
+ curl -s http://localhost:8080/api/info | jq
329
+ exit 0
330
+ else
331
+ echo "gitCommitIds do not match!"
332
+ echo "Instance Commit ID: $INSTANCE_COMMIT_ID"
333
+ echo "PR Commit ID: $PR_COMMIT_ID"
334
+ exit 1
335
+ fi
336
+ - run :
337
+ name : Run API Tests
338
+ environment :
339
+ API_TEST_HOST : http://localhost:8080
340
+ BACKEND_ROOT : /tmp/repos/cbioportal
341
+ command : |
342
+ cd cbioportal-frontend
343
+ nvm install 15.2.1
344
+ nvm use 15.2.1
345
+ npm install -g yarn@1.22.5
346
+ yarn --ignore-engines
347
+ yarn run apitests
348
+
349
+ - store_artifacts :
350
+ path : /tmp/repos/cbioportal-test/web-metadata.json
351
+ - store_artifacts :
352
+ path : /tmp/repos/docker-compose-logs.txt
353
+
226
354
227
355
workflows :
228
356
version : 2
@@ -238,3 +366,22 @@ workflows:
238
366
- build_backend
239
367
- pull_frontend_codebase
240
368
- install_yarn
369
+ api_tests :
370
+ jobs :
371
+ - pull_cbioportal_test_codebase
372
+ - pull_cbioportal_frontend_codebase
373
+ - wait_for_approval :
374
+ type : approval
375
+ requires :
376
+ - pull_cbioportal_test_codebase
377
+ - pull_cbioportal_frontend_codebase
378
+ - build_push_image :
379
+ context :
380
+ - api-tests
381
+ requires :
382
+ - wait_for_approval
383
+ - run_api_tests :
384
+ context :
385
+ - api-tests
386
+ requires :
387
+ - build_push_image
0 commit comments