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 working_directory: ~/repo
jobs: jobs:
PR_UNIT_TESTS: CHECKOUT:
<<: *defaults <<: *defaults
steps: steps:
# Enable yarn workspaces # Enable yarn workspaces
- run: yarn config set workspaces-experimental true - run: yarn config set workspaces-experimental true
# Checkout code and ALL Git Tags # Checkout code and ALL Git Tags
- checkout: - checkout:
post: post:
@ -50,6 +48,12 @@ jobs:
- ~/.cache ## Cache yarn and Cypress - ~/.cache ## Cache yarn and Cypress
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
UNIT_TESTS:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
# RUN TESTS # RUN TESTS
- run: - run:
name: 'JavaScript Test Suite' name: 'JavaScript Test Suite'
@ -88,72 +92,7 @@ jobs:
root: ~/repo root: ~/repo
paths: . paths: .
MERGE_UNIT_TESTS: NPM_PUBLISH:
<<: *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:
<<: *defaults <<: *defaults
steps: steps:
- attach_workspace: - attach_workspace:
@ -177,7 +116,7 @@ jobs:
root: ~/repo root: ~/repo
paths: . paths: .
docs_publish: DOCS_PUBLISH:
<<: *defaults <<: *defaults
steps: steps:
- attach_workspace: - attach_workspace:
@ -194,7 +133,7 @@ jobs:
- run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh - run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh
- run: ~/repo/.circleci/build-and-publish-docs.sh - run: ~/repo/.circleci/build-and-publish-docs.sh
docker_publish: DOCKER_PUBLISH:
<<: *defaults <<: *defaults
steps: steps:
- attach_workspace: - attach_workspace:
@ -223,7 +162,7 @@ jobs:
docker push ohif/$IMAGE_NAME:latest docker push ohif/$IMAGE_NAME:latest
fi fi
viewer_demo_build: VIEWER_DEMO_BUILD:
<<: *defaults <<: *defaults
steps: steps:
- attach_workspace: - attach_workspace:
@ -248,7 +187,7 @@ jobs:
root: ~/repo root: ~/repo
paths: . paths: .
viewer_demo_publish: VIEWER_DEMO_PUBLISH:
working_directory: ~/repo working_directory: ~/repo
docker: docker:
- image: google/cloud-sdk - image: google/cloud-sdk
@ -274,15 +213,19 @@ workflows:
# PULL REQUESTS # PULL REQUESTS
PR_CHECKS: PR_CHECKS:
jobs: jobs:
- PR_UNIT_TESTS: - CHECKOUT:
filters: filters:
branches: branches:
ignore: ignore:
- master - master
- feature/* - feature/*
- hotfix/* - hotfix/*
# E2E tests against PWA usage (dev) - UNIT_TESTS:
requires:
- CHECKOUT
# E2E: PWA
- cypress/run: - cypress/run:
name: 'E2E: PWA'
pre-steps: pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest add wait-on' # Use yarn latest
@ -292,15 +235,13 @@ workflows:
build: yarn run build build: yarn run build
start: yarn run test:e2e:dist start: yarn run test:e2e:dist
wait-on: 'http://localhost:3000' wait-on: 'http://localhost:3000'
no-workspace: true # Don't persist workspace
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
post-steps: no-workspace: true # Don't persist workspace
- store_test_results:
path: cypress/results
requires: requires:
- PR_UNIT_TESTS - UNIT_TESTS
# E2E Tests against script-tag usage # E2E: script-tag
- cypress/run: - cypress/run:
name: 'E2E: Script Tag'
pre-steps: pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest add wait-on' # Use yarn latest
@ -310,54 +251,76 @@ workflows:
build: yarn run build:package build: yarn run build:package
start: yarn run test:e2e:dist start: yarn run test:e2e:dist
wait-on: 'http://localhost:3000' wait-on: 'http://localhost:3000'
no-workspace: true # Don't persist workspace
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
post-steps: no-workspace: true # Don't persist workspace
- store_test_results:
path: cypress/results
requires: requires:
- PR_UNIT_TESTS - UNIT_TESTS
# MERGE TO MASTER # MERGE TO MASTER
RELEASE: RELEASE:
jobs: jobs:
- MERGE_UNIT_TESTS: - CHECKOUT:
filters: filters:
branches: branches:
only: master only: master
# Cypress job added by `cypress-io` orb - UNIT_TESTS:
requires:
- CHECKOUT
# E2E: PWA + Persist
- cypress/run: - cypress/run:
name: 'E2E: PWA'
pre-steps: pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest add wait-on' # Use yarn latest
yarn: true yarn: true
record: true record: true
store_artifacts: true store_artifacts: true
start: yarn run dev
wait-on: 'http://localhost:3000'
working_directory: platform/viewer 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" }}' cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps: post-steps:
- store_test_results: - store_test_results:
path: cypress/results path: cypress/results
requires: requires:
- MERGE_UNIT_TESTS - UNIT_TESTS
# Update NPM # E2E: script-tag
- npm_publish: - 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: requires:
- cypress/run - UNIT_TESTS
# Update docs.ohif.org # Update NPM
- docs_publish: - NPM_PUBLISH:
requires: requires:
- cypress/run - cypress/run
# Update hub.docker.org # Update hub.docker.org
# - docker_publish: # - DOCKER_PUBLISH:
# requires: # requires:
# - npm_publish # - NPM_PUBLISH
# Update viewer.ohif.org # Update viewer.ohif.org
- viewer_demo_build: # Update docs.ohif.org
- DOCS_PUBLISH:
requires: requires:
- cypress/run - cypress/run
- viewer_demo_publish: - VIEWER_DEMO_BUILD:
requires: requires:
- viewer_demo_build - cypress/run
- VIEWER_DEMO_PUBLISH:
requires:
- VIEWER_DEMO_BUILD