ci: update RELEASE to use new cypress tests

This commit is contained in:
dannyrb 2019-09-09 21:34:23 -04:00
parent a88f37595d
commit 61d2caef96

View File

@ -23,13 +23,11 @@ defaults: &defaults
working_directory: ~/repo
jobs:
PR_UNIT_TESTS:
CHECKOUT:
<<: *defaults
steps:
# Enable yarn workspaces
- run: yarn config set workspaces-experimental true
# Checkout code and ALL Git Tags
- checkout:
post:
@ -50,6 +48,12 @@ jobs:
- ~/.cache ## Cache yarn and Cypress
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
UNIT_TESTS:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
# RUN TESTS
- run:
name: 'JavaScript Test Suite'
@ -88,72 +92,7 @@ jobs:
root: ~/repo
paths: .
MERGE_UNIT_TESTS:
<<: *defaults
steps:
# Enable yarn workspaces
- run: yarn config set workspaces-experimental true
# Checkout code and ALL Git Tags
- checkout:
post:
- git fetch --all
- restore_cache:
name: Restore Yarn and Cypress Package Cache
keys:
# when lock file changes, use increasingly general patterns to restore cache
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-v1-{{ .Branch }}-
- yarn-packages-v1-
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
paths:
- ~/.cache ## Cache yarn and Cypress
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
# RUN TESTS
- run:
name: 'JavaScript Test Suite'
command: yarn run test:unit:ci
# PLATFORM/VIEWER
- run:
name: 'VIEWER: Combine report output'
command: |
viewerCov="/home/circleci/repo/platform/viewer/coverage"
touch "${viewerCov}/reports"
cat "${viewerCov}/clover.xml" >> "${viewerCov}/reports"
echo "\<<\<<\<< EOF" >> "${viewerCov}/reports"
cat "${viewerCov}/lcov.info" >>"${viewerCov}/reports"
echo "\<<\<<\<< EOF" >> "${viewerCov}/reports"
- codecov/upload:
file: '/home/circleci/repo/platform/viewer/coverage/reports'
flags: 'viewer'
# PLATFORM/CORE
- run:
name: 'CORE: Combine report output'
command: |
coreCov="/home/circleci/repo/platform/core/coverage"
touch "${coreCov}/reports"
cat "${coreCov}/clover.xml" >> "${coreCov}/reports"
echo "\<<\<<\<< EOF" >> "${coreCov}/reports"
cat "${coreCov}/lcov.info" >> "${coreCov}/reports"
echo "\<<\<<\<< EOF" >> "${coreCov}/reports"
- codecov/upload:
file: '/home/circleci/repo/platform/core/coverage/reports'
flags: 'core'
# Persist :+1:
- persist_to_workspace:
root: ~/repo
paths: .
npm_publish:
NPM_PUBLISH:
<<: *defaults
steps:
- attach_workspace:
@ -177,7 +116,7 @@ jobs:
root: ~/repo
paths: .
docs_publish:
DOCS_PUBLISH:
<<: *defaults
steps:
- attach_workspace:
@ -194,7 +133,7 @@ jobs:
- run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh
- run: ~/repo/.circleci/build-and-publish-docs.sh
docker_publish:
DOCKER_PUBLISH:
<<: *defaults
steps:
- attach_workspace:
@ -223,7 +162,7 @@ jobs:
docker push ohif/$IMAGE_NAME:latest
fi
viewer_demo_build:
VIEWER_DEMO_BUILD:
<<: *defaults
steps:
- attach_workspace:
@ -248,7 +187,7 @@ jobs:
root: ~/repo
paths: .
viewer_demo_publish:
VIEWER_DEMO_PUBLISH:
working_directory: ~/repo
docker:
- image: google/cloud-sdk
@ -274,15 +213,19 @@ workflows:
# PULL REQUESTS
PR_CHECKS:
jobs:
- PR_UNIT_TESTS:
- CHECKOUT:
filters:
branches:
ignore:
- master
- feature/*
- hotfix/*
# E2E tests against PWA usage (dev)
- UNIT_TESTS:
requires:
- CHECKOUT
# E2E: PWA
- cypress/run:
name: 'E2E: PWA'
pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest
@ -292,15 +235,13 @@ workflows:
build: yarn run build
start: yarn run test:e2e:dist
wait-on: 'http://localhost:3000'
no-workspace: true # Don't persist workspace
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
post-steps:
- store_test_results:
path: cypress/results
no-workspace: true # Don't persist workspace
requires:
- PR_UNIT_TESTS
# E2E Tests against script-tag usage
- UNIT_TESTS
# E2E: script-tag
- cypress/run:
name: 'E2E: Script Tag'
pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest
@ -310,54 +251,76 @@ workflows:
build: yarn run build:package
start: yarn run test:e2e:dist
wait-on: 'http://localhost:3000'
no-workspace: true # Don't persist workspace
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
post-steps:
- store_test_results:
path: cypress/results
no-workspace: true # Don't persist workspace
requires:
- PR_UNIT_TESTS
- UNIT_TESTS
# MERGE TO MASTER
RELEASE:
jobs:
- MERGE_UNIT_TESTS:
- CHECKOUT:
filters:
branches:
only: master
# Cypress job added by `cypress-io` orb
- UNIT_TESTS:
requires:
- CHECKOUT
# E2E: PWA + Persist
- cypress/run:
name: 'E2E: PWA'
pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest
yarn: true
record: true
store_artifacts: true
start: yarn run dev
wait-on: 'http://localhost:3000'
working_directory: platform/viewer
build: yarn run build
start: yarn run test:e2e:dist
wait-on: 'http://localhost:3000'
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps:
- store_test_results:
path: cypress/results
requires:
- MERGE_UNIT_TESTS
# Update NPM
- npm_publish:
- UNIT_TESTS
# E2E: script-tag
- cypress/run:
name: 'E2E: Script Tag'
pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest
yarn: true
store_artifacts: true
working_directory: platform/viewer
build: yarn run build:package
start: yarn run test:e2e:dist
wait-on: 'http://localhost:3000'
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps:
- store_test_results:
path: cypress/results
requires:
- cypress/run
# Update docs.ohif.org
- docs_publish:
- UNIT_TESTS
# Update NPM
- NPM_PUBLISH:
requires:
- cypress/run
# Update hub.docker.org
# - docker_publish:
# - DOCKER_PUBLISH:
# requires:
# - npm_publish
# - NPM_PUBLISH
# Update viewer.ohif.org
- viewer_demo_build:
# Update docs.ohif.org
- DOCS_PUBLISH:
requires:
- cypress/run
- viewer_demo_publish:
- VIEWER_DEMO_BUILD:
requires:
- viewer_demo_build
- cypress/run
- VIEWER_DEMO_PUBLISH:
requires:
- VIEWER_DEMO_BUILD