Fix path; split PR and Merge unit tests into separate jobs

This commit is contained in:
dannyrb 2019-08-05 13:04:27 -04:00
parent 7c043b46b4
commit b2dfb6e0f7

View File

@ -18,8 +18,9 @@ defaults: &defaults
working_directory: ~/repo
jobs:
unit_tests:
PR_UNIT_TESTS:
<<: *defaults
steps:
# Enable yarn workspaces
- run: yarn config set workspaces-experimental true
@ -28,7 +29,6 @@ jobs:
- checkout:
post:
- git fetch --all
- restore_cache:
name: Restore Yarn and Cypress Package Cache
keys:
@ -36,20 +36,16 @@ jobs:
- 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" }}
# Test
# TODO: lerna:tests
# https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/
# RUN TESTS
- run:
name: "JavaScript Test Suite"
command: yarn run test:unit:ci
@ -58,13 +54,12 @@ jobs:
- run:
name: "VIEWER: Combine report output"
command: |
viewerCov="~/repo/platform/viewer/coverage"
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"
@ -78,7 +73,65 @@ jobs:
echo "\<<\<<\<< EOF" >> ~/repo/platform/core/coverage/reports
cat ~/repo/platform/core/coverage/lcov.info >> ~/repo/platform/core/coverage/reports
echo "\<<\<<\<< EOF" >> ~/repo/platform/core/coverage/reports
- codecov/upload:
file: "/home/circleci/repo/platform/core/coverage/reports"
flags: "core"
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: |
touch ~/repo/platform/core/coverage/reports
cat ~/repo/platform/core/coverage/clover.xml >> ~/repo/platform/core/coverage/reports
echo "\<<\<<\<< EOF" >> ~/repo/platform/core/coverage/reports
cat ~/repo/platform/core/coverage/lcov.info >> ~/repo/platform/core/coverage/reports
echo "\<<\<<\<< EOF" >> ~/repo/platform/core/coverage/reports
- codecov/upload:
file: "/home/circleci/repo/platform/core/coverage/reports"
flags: "core"
@ -249,7 +302,7 @@ workflows:
# PULL REQUESTS
pull_requests:
jobs:
- unit_tests:
- PR_UNIT_TESTS:
filters:
branches:
ignore:
@ -260,13 +313,13 @@ workflows:
# MERGE TO MASTER
cut_release:
jobs:
- unit_tests:
- MERGE_UNIT_TESTS:
filters:
branches:
only: master
- e2e_test:
requires:
- unit_tests
- MERGE_UNIT_TESTS
# Update NPM
- npm_publish:
requires: