Change copy syntax; try running tests on viewers from root for circleci

This commit is contained in:
dannyrb 2019-07-16 13:31:52 -04:00
parent 0b62b720c5
commit 413214786d
4 changed files with 29 additions and 19 deletions

View File

@ -10,16 +10,19 @@ version: 2
###
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:10.15.1
- image: circleci/node:10.16.0
working_directory: ~/repo
jobs:
build_and_test:
unit_tests:
<<: *defaults
steps:
# Download and cache dependencies
- checkout
# Checkout code and ALL Git Tags
- checkout:
post:
- git fetch --all
- restore_cache:
name: Restore Yarn and Cypress Package Cache
keys:
@ -27,27 +30,32 @@ 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" }}
# Build & Test
- run: yarn build:package:ci
# Test
# TODO: lerna:tests
# https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/
- run:
name: 'JavaScript Test Suite'
command: yarn test:unit:ci
name: "JavaScript Test Suite"
command: yarn run test:unit
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
# Store result
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit
# Persist :+1:
- persist_to_workspace:
root: ~/repo
@ -167,7 +175,7 @@ jobs:
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Build & Test
- run:
name: 'Build Demo Site, Upload SourceMaps, Send Deploy Notification'
name: "Build Demo Site, Upload SourceMaps, Send Deploy Notification"
command: |
yarn build:demo:ci
perl -i -pe 's#</head>#`cat .circleci/rollbar.html` #e' build/index.html
@ -214,7 +222,7 @@ workflows:
# PULL REQUESTS
pull_requests:
jobs:
- build_and_test:
- unit_tests:
filters:
branches:
ignore:
@ -225,13 +233,13 @@ workflows:
# MERGE TO MASTER
cut_release:
jobs:
- build_and_test:
- unit_tests:
filters:
branches:
only: master
- e2e_test:
requires:
- build_and_test
- unit_tests
# Update NPM
- npm_publish:
requires:

View File

@ -77,15 +77,15 @@ yarn install --no-ignore-optional --pure-lockfile
cd ./platform/viewer/
# Create a Versions File
node -p -e "export default require('./package.json').version;" > src/version.js
node -p -e "'export default require(\'./package.json\').version;'" > src/version.js
# Copy over wado-image-loader codecs and worker file
cp './../../node_modules/cornerstone-wado-image-loader/dist/*.min.js*' public -v
cp ./../../node_modules/cornerstone-wado-image-loader/dist/*.min.js* public -v
# Build using react-scripts
# npx cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build
# Build using WebPack
# TODO: consume public/config correctly instead of hardcode
npx webpack --config config/webpack.prod.js --mode production --env.production
# Copy output to the folder that is our publish target
cp 'dist/**/*' ./../../docs/latest/_book/demo --verbose
cp dist/**/* ./../../docs/latest/_book/demo --verbose
echo 'Nothing left to see here. Go home, folks.'

View File

@ -12,7 +12,9 @@
},
"scripts": {
"start": "lerna run lerna:start --parallel",
"build": "lerna run lerna:build --parallel"
"build": "lerna run lerna:build --parallel",
"test:unit": "lerna run lerna:test:unit --parallel",
"build:pwa:ci": ""
},
"devDependencies": {
"@babel/core": "^7.5.0",

View File

@ -14,6 +14,7 @@
"proxy": "http://localhost:8042",
"scripts": {
"lerna:start": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --mode development -w -d",
"lerna:test:unit": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",
"cm": "npx git-cz",
"dev": "yarn run preBuild && react-scripts start",
"dev:debug": "react-scripts start",
@ -23,7 +24,6 @@
"build:demo:ci": "yarn run preBuild && cross-env PUBLIC_URL=/ REACT_APP_CONFIG=config/demo.js react-scripts --max_old_space_size=4096 build",
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",
"test:unit": "jest",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",
"test:e2e:ci": "start-server-and-test start http://localhost:5000 cy:run:ci",
"start": "yarn run dev",
"predeploy": "cd example && npm install && yarn run build:package",