ci: Set cache key to only use yarn.lock checksum (#1031)
* ci: Set cache key to only use yarn.lock checksum * Use increasingly general pattern for restoring the cache * Avoid running script tag e2e tests twice * Performance improvements for CI * Valid YAML * Valid YAML? * Valid YAML!!!! * Update Node image, update yarn version * circle * serve
This commit is contained in:
parent
beb7083e55
commit
d6862e7418
@ -17,46 +17,43 @@ orbs:
|
|||||||
|
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:10.16.0
|
- image: circleci/node:12.9.1
|
||||||
environment:
|
environment:
|
||||||
TERM: xterm # Enable colors in term
|
TERM: xterm # Enable colors in term
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CHECKOUT:
|
UNIT_TESTS:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
steps:
|
steps:
|
||||||
|
# Update yarn
|
||||||
|
- run: yarn -v
|
||||||
|
#- run: rm -rf ~/.yarn && npm i -g yarn && yarn -v
|
||||||
|
|
||||||
# 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:
|
||||||
- git fetch --all
|
- git fetch --all
|
||||||
|
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
name: Restore Yarn and Cypress Package Cache
|
name: Restore Yarn and Cypress Package Cache
|
||||||
keys:
|
keys:
|
||||||
# when lock file changes, use increasingly general patterns to restore cache
|
# when lock file changes, use increasingly general patterns to restore cache
|
||||||
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
- yarn-packages-{{ checksum "yarn.lock" }}
|
||||||
- yarn-packages-v1-{{ .Branch }}-
|
- yarn-packages-
|
||||||
- yarn-packages-v1-
|
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: yarn install --frozen-lockfile
|
command: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: Save Yarn Package Cache
|
name: Save Yarn Package Cache
|
||||||
paths:
|
paths:
|
||||||
- ~/.cache ## Cache yarn and Cypress
|
- ~/.cache ## Cache yarn and Cypress
|
||||||
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
key: yarn-packages-{{ checksum "yarn.lock" }}
|
||||||
# Persist :+1:
|
|
||||||
- persist_to_workspace:
|
|
||||||
root: ~/repo
|
|
||||||
paths: .
|
|
||||||
|
|
||||||
UNIT_TESTS:
|
|
||||||
<<: *defaults
|
|
||||||
steps:
|
|
||||||
- attach_workspace:
|
|
||||||
at: ~/repo
|
|
||||||
|
|
||||||
# RUN TESTS
|
# RUN TESTS
|
||||||
- run:
|
- run:
|
||||||
@ -91,8 +88,72 @@ jobs:
|
|||||||
file: '/home/circleci/repo/platform/core/coverage/reports'
|
file: '/home/circleci/repo/platform/core/coverage/reports'
|
||||||
flags: 'core'
|
flags: 'core'
|
||||||
|
|
||||||
|
UNIT_TESTS_PERSIST_WORKSPACE:
|
||||||
|
<<: *defaults
|
||||||
|
steps:
|
||||||
|
# Update yarn
|
||||||
|
#- run: rm -rf ~/.yarn && npm i -g yarn && yarn -v
|
||||||
|
|
||||||
|
# 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-{{ checksum "yarn.lock" }}
|
||||||
|
- yarn-packages-
|
||||||
|
|
||||||
|
- 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-{{ 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 :+1:
|
||||||
- persist_to_workspace:
|
- persist_to_workspace: &persist_to_workspace
|
||||||
root: ~/repo
|
root: ~/repo
|
||||||
paths: .
|
paths: .
|
||||||
|
|
||||||
@ -217,16 +278,13 @@ workflows:
|
|||||||
# PULL REQUESTS
|
# PULL REQUESTS
|
||||||
PR_CHECKS:
|
PR_CHECKS:
|
||||||
jobs:
|
jobs:
|
||||||
- CHECKOUT:
|
- UNIT_TESTS:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore:
|
ignore:
|
||||||
- master
|
- master
|
||||||
- feature/*
|
- feature/*
|
||||||
- hotfix/*
|
- hotfix/*
|
||||||
- UNIT_TESTS:
|
|
||||||
requires:
|
|
||||||
- CHECKOUT
|
|
||||||
# E2E: PWA
|
# E2E: PWA
|
||||||
- cypress/run:
|
- cypress/run:
|
||||||
name: 'E2E: PWA'
|
name: 'E2E: PWA'
|
||||||
@ -237,9 +295,9 @@ workflows:
|
|||||||
store_artifacts: false
|
store_artifacts: false
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: yarn run build:e2e
|
build: yarn run build:e2e
|
||||||
start: yarn run test:e2e:dist
|
start: yarn run test:e2e:serve
|
||||||
wait-on: 'http://localhost:3000'
|
wait-on: 'http://localhost:3000'
|
||||||
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
|
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
||||||
no-workspace: true # Don't persist workspace
|
no-workspace: true # Don't persist workspace
|
||||||
post-steps:
|
post-steps:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
@ -256,9 +314,9 @@ workflows:
|
|||||||
store_artifacts: false
|
store_artifacts: false
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: yarn run build:package
|
build: yarn run build:package
|
||||||
start: yarn run test:e2e:dist
|
start: yarn run test:e2e:serve
|
||||||
wait-on: 'http://localhost:3000'
|
wait-on: 'http://localhost:3000'
|
||||||
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
|
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
||||||
no-workspace: true # Don't persist workspace
|
no-workspace: true # Don't persist workspace
|
||||||
post-steps:
|
post-steps:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
@ -269,13 +327,10 @@ workflows:
|
|||||||
# MERGE TO MASTER
|
# MERGE TO MASTER
|
||||||
RELEASE:
|
RELEASE:
|
||||||
jobs:
|
jobs:
|
||||||
- CHECKOUT:
|
- UNIT_TESTS_PERSIST_WORKSPACE:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only: master
|
only: master
|
||||||
- UNIT_TESTS:
|
|
||||||
requires:
|
|
||||||
- CHECKOUT
|
|
||||||
# E2E: PWA + Persist
|
# E2E: PWA + Persist
|
||||||
- cypress/run:
|
- cypress/run:
|
||||||
name: 'E2E: PWA'
|
name: 'E2E: PWA'
|
||||||
@ -287,9 +342,9 @@ workflows:
|
|||||||
store_artifacts: true
|
store_artifacts: true
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: yarn run build:e2e
|
build: yarn run build:e2e
|
||||||
start: yarn run test:e2e:dist
|
start: yarn run test:e2e:serve
|
||||||
wait-on: 'http://localhost:3000'
|
wait-on: 'http://localhost:3000'
|
||||||
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
|
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
||||||
no-workspace: true # Don't persist workspace
|
no-workspace: true # Don't persist workspace
|
||||||
post-steps:
|
post-steps:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
@ -297,7 +352,7 @@ workflows:
|
|||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: cypress/results
|
path: cypress/results
|
||||||
requires:
|
requires:
|
||||||
- UNIT_TESTS
|
- UNIT_TESTS_PERSIST_WORKSPACE
|
||||||
# E2E: script-tag
|
# E2E: script-tag
|
||||||
- cypress/run:
|
- cypress/run:
|
||||||
name: 'E2E: Script Tag'
|
name: 'E2E: Script Tag'
|
||||||
@ -308,9 +363,9 @@ workflows:
|
|||||||
store_artifacts: false
|
store_artifacts: false
|
||||||
working_directory: platform/viewer
|
working_directory: platform/viewer
|
||||||
build: yarn run build:package
|
build: yarn run build:package
|
||||||
start: yarn run test:e2e:dist
|
start: yarn run test:e2e:serve
|
||||||
wait-on: 'http://localhost:3000'
|
wait-on: 'http://localhost:3000'
|
||||||
cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}'
|
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
|
||||||
no-workspace: true # Don't persist workspace
|
no-workspace: true # Don't persist workspace
|
||||||
post-steps:
|
post-steps:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
@ -318,7 +373,7 @@ workflows:
|
|||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: cypress/results
|
path: cypress/results
|
||||||
requires:
|
requires:
|
||||||
- UNIT_TESTS
|
- UNIT_TESTS_PERSIST_WORKSPACE
|
||||||
# Update NPM
|
# Update NPM
|
||||||
- NPM_PUBLISH:
|
- NPM_PUBLISH:
|
||||||
requires:
|
requires:
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
"test:unit:ci": "lerna run test:unit:ci --parallel --stream",
|
"test:unit:ci": "lerna run test:unit:ci --parallel --stream",
|
||||||
"test:e2e": "lerna run test:e2e --stream",
|
"test:e2e": "lerna run test:e2e --stream",
|
||||||
"test:e2e:dist": "lerna run test:e2e:dist --stream",
|
"test:e2e:dist": "lerna run test:e2e:dist --stream",
|
||||||
|
"test:e2e:serve": "lerna run test:e2e:serve --stream",
|
||||||
"see-changed": "lerna changed",
|
"see-changed": "lerna changed",
|
||||||
"docs:publish": "chmod +x ./build-and-publish-docs.sh && ./build-and-publish-docs.sh",
|
"docs:publish": "chmod +x ./build-and-publish-docs.sh && ./build-and-publish-docs.sh",
|
||||||
"release": "yarn run lerna:version && yarn run lerna:publish",
|
"release": "yarn run lerna:version && yarn run lerna:publish",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user