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

View File

@ -77,15 +77,15 @@ yarn install --no-ignore-optional --pure-lockfile
cd ./platform/viewer/ cd ./platform/viewer/
# Create a Versions File # 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 # 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 # Build using react-scripts
# npx cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build # npx cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build
# Build using WebPack # Build using WebPack
# TODO: consume public/config correctly instead of hardcode # TODO: consume public/config correctly instead of hardcode
npx webpack --config config/webpack.prod.js --mode production --env.production npx webpack --config config/webpack.prod.js --mode production --env.production
# Copy output to the folder that is our publish target # 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.' echo 'Nothing left to see here. Go home, folks.'

View File

@ -12,7 +12,9 @@
}, },
"scripts": { "scripts": {
"start": "lerna run lerna:start --parallel", "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": { "devDependencies": {
"@babel/core": "^7.5.0", "@babel/core": "^7.5.0",

View File

@ -14,6 +14,7 @@
"proxy": "http://localhost:8042", "proxy": "http://localhost:8042",
"scripts": { "scripts": {
"lerna:start": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --mode development -w -d", "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", "cm": "npx git-cz",
"dev": "yarn run preBuild && react-scripts start", "dev": "yarn run preBuild && react-scripts start",
"dev:debug": "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", "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}", "lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",
"test:unit": "jest", "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", "test:e2e:ci": "start-server-and-test start http://localhost:5000 cy:run:ci",
"start": "yarn run dev", "start": "yarn run dev",
"predeploy": "cd example && npm install && yarn run build:package", "predeploy": "cd example && npm install && yarn run build:package",