Skip to content

Commit

Permalink
chore: Clean up unused files, imports, and work on getting end-to-end…
Browse files Browse the repository at this point in the history
… tests and unit tests running (#2272)
  • Loading branch information
swederik authored Mar 1, 2021
1 parent 414ebc6 commit 0db81b3
Show file tree
Hide file tree
Showing 374 changed files with 14,205 additions and 21,355 deletions.
149 changes: 142 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,23 @@ version: 2.1
##
orbs:
codecov: codecov/[email protected]
cypress: cypress-io/[email protected]
cypress: cypress-io/[email protected]
executors:
# Custom executor to override Cypress config
deploy-to-prod-executor:
docker:
- image: 'cypress/browsers:node14.15.0-chrome86-ff82'
environment:
CYPRESS_BASE_URL: https://ohif-staging.netlify.com/
chrome-and-pacs:
docker:
# Primary container image where all steps run.
- image: 'cypress/browsers:node14.15.0-chrome86-ff82'
- image: 'ohif/viewer-testdata:0.1-test'

defaults: &defaults
docker:
- image: circleci/node:12.9.1
- image: circleci/node:14.15.0
environment:
TERM: xterm # Enable colors in term
QUICK_BUILD: true
Expand Down Expand Up @@ -170,7 +182,7 @@ jobs:

DEPLOY_TO_DEV:
docker:
- image: circleci/node:12.9.1
- image: circleci/node:14.15.0
environment:
TERM: xterm
NETLIFY_SITE_ID: 32708787-c9b0-4634-b50f-7ca41952da77
Expand All @@ -185,7 +197,7 @@ jobs:

DEPLOY_TO_STAGING:
docker:
- image: circleci/node:12.9.1
- image: circleci/node:14.15.0
environment:
TERM: xterm
NETLIFY_SITE_ID: c7502ae3-b150-493c-8422-05701e44a969
Expand All @@ -200,7 +212,7 @@ jobs:

DEPLOY_TO_PRODUCTION:
docker:
- image: circleci/node:12.9.1
- image: circleci/node:14.15.0
environment:
TERM: xterm
NETLIFY_SITE_ID: 79c4a5da-5c95-4dc9-84f7-45fd9dfe21b0
Expand Down Expand Up @@ -307,8 +319,73 @@ jobs:
workflows:
version: 2

# WORKFLOWS Disabled until this feature branch is further along
# See Master's CircleCI Config
PR_CHECKS:
jobs:
- UNIT_TESTS:
filters:
branches:
ignore:
- master
- feature/*
- hotfix/*
# E2E: PWA
- cypress/run:
name: 'E2E: PWA'
executor: chrome-and-pacs
browser: chrome
pre-steps:
- run: |
# Clear yarn cache; update to latest
rm -rf ~/.yarn
npm i -g yarn
yarn -v
yarn: true
record: true
store_artifacts: true
working_directory: platform/viewer
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build
start: yarn run test:e2e:serve
spec: 'cypress/integration/**/*'
wait-on: 'http://localhost:3000'
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps:
- store_artifacts:
path: platform/viewer/cypress/screenshots
- store_artifacts:
path: platform/viewer/cypress/videos
- store_test_results:
path: platform/viewer/cypress/results
requires:
- UNIT_TESTS

PR_OPTIONAL_VISUAL_TESTS:
jobs:
- AWAIT_APPROVAL:
type: approval
# Update hub.docker.org
- cypress/run:
name: 'Generate Percy Snapshots'
executor: cypress/browsers-chrome76
browser: chrome
pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest
yarn: true
store_artifacts: false
working_directory: platform/viewer
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build
# start server --> verify running --> percy + chrome + cypress
command: yarn run test:e2e:dist
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps:
- store_artifacts:
path: platform/viewer/cypress/screenshots
- store_artifacts:
path: platform/viewer/cypress/videos
requires:
- AWAIT_APPROVAL

DEPLOY:
jobs:
Expand All @@ -319,3 +396,61 @@ workflows:
- DEPLOY_TO_DEV:
requires:
- BUILD
- PROMOTE_TO_STAGING:
type: approval
requires:
- DEPLOY_TO_DEV
- DEPLOY_TO_STAGING:
requires:
- PROMOTE_TO_STAGING
- PROMOTE_TO_PRODUCTION:
type: approval
requires:
- DEPLOY_TO_STAGING
- DEPLOY_TO_PRODUCTION:
requires:
- PROMOTE_TO_PRODUCTION
###
# Unit and E2E tests have already run for PR_CHECKS
# Re-running should not gain us any confidence here
###
RELEASE:
jobs:
- NPM_PUBLISH:
filters:
branches:
only: master
- DOCS_PUBLISH:
filters:
branches:
only: master
# Update base branch snapshots
# and record a Cypress dashboard test run
- cypress/run:
name: 'Generate Percy Snapshots'
executor: cypress/browsers-chrome76
browser: chrome
pre-steps:
- run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global
add wait-on' # Use yarn latest
yarn: true
store_artifacts: false
working_directory: platform/viewer
build: npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js yarn run build
# start server --> verify running --> percy + chrome + cypress
command: yarn run test:e2e:dist
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps:
- store_artifacts:
path: platform/viewer/cypress/screenshots
- store_artifacts:
path: platform/viewer/cypress/videos
- store_test_results:
path: platform/viewer/cypress/results
filters:
branches:
only: master
- DOCKER_MASTER_PUBLISH:
requires:
- NPM_PUBLISH
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
},
"rules": {
"react/jsx-props-no-spreading": "error",
"react-hooks/exhaustive-deps": "false"
"react-hooks/exhaustive-deps": "false",
"import/no-unused-modules": [1, {"unusedExports": true}]
},
"globals": {
"cy": true,
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"sysoev.language-stylus",
"dbaeumer.vscode-eslint",
"mikestead.dotenv",
"bungcip.better-toml",
Expand Down
10 changes: 0 additions & 10 deletions .webpack/rules/stylusToJavaScript.js

This file was deleted.

13 changes: 13 additions & 0 deletions .webpack/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const TerserJSPlugin = require('terser-webpack-plugin');
const NODE_ENV = process.env.NODE_ENV;
const QUICK_BUILD = process.env.QUICK_BUILD;
const BUILD_NUM = process.env.CIRCLE_BUILD_NUM || '0';
const { UnusedFilesWebpackPlugin } = require("unused-files-webpack-plugin");

//
dotenv.config();
Expand Down Expand Up @@ -99,6 +100,18 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
process.env.LOCIZE_API_KEY || ''
),
}),
new UnusedFilesWebpackPlugin({
failOnUnused: true,
globOptions: {
ignore: [
"node_modules/**/*",
"index.umd.js",
"sanity.test.js",
"__mocks__/fileMock.js",
"__tests__/globalSetup.js"
]
}
}),
],
// Fix: https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
// For issue in cornerstone-wado-image-loader
Expand Down
19 changes: 0 additions & 19 deletions .webpack/webpack.commonjs.js

This file was deleted.

45 changes: 21 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ also supports a number of commands that can be found in their respective
| `dev:project <package-name>` | Replace with `core`, `ui`, `i18n`, `cornerstone`, `vtk`, etc. |
| `test:unit` | Jest multi-project test runner; overall coverage |
| **Deploy** | |
| `build`\* | Builds production output for our PWA Viewer |
| `build:package`\* | Builds production `commonjs` output for our Viewer |
| `build:package-all`\* | Builds commonjs bundles for all projects |
| `build`\* | Builds production output for our PWA Viewer | |

\* - For more information on our different builds, check out our [Deploy
Docs][deployment-docs]
Expand All @@ -189,24 +187,27 @@ you'll see the following:

```bash
.
├── extensions #
│ ├── _example # Skeleton of example extension
│ ├── cornerstone # 2D images w/ Cornerstone.js
│ ├── dicom-html # Structured Reports as HTML in viewport
│ ├── dicom-microscopy # Whole slide microscopy viewing
│ ├── dicom-pdf # View DICOM wrapped PDFs in viewport
│ └── vtk # MPR and Volume support w/ VTK.js
├── extensions #
│ ├── _example # Skeleton of example extension
│ ├── default #
│ ├── cornerstone # 2D images w/ Cornerstone.js
│ ├── dicom-sr #
│ └── measurement-tracking #
├── platform #
│ ├── core # Business Logic
│ ├── i18n # Internationalization Support
│ ├── ui # React component library
│ └── viewer # Connects platform and extension projects
├── modes #
│ ├── _example # Skeleton of example mode
│ └── longitudinal #
├── ... # misc. shared configuration
├── lerna.json # MonoRepo (Lerna) settings
├── package.json # Shared devDependencies and commands
└── README.md # This file
├── platform #
│ ├── core # Business Logic
│ ├── i18n # Internationalization Support
│ ├── ui # React component library
│ └── viewer # Connects platform and extension projects
├── ... # misc. shared configuration
├── lerna.json # MonoRepo (Lerna) settings
├── package.json # Shared devDependencies and commands
└── README.md # This file
```

Want to better understand why and how we've structured this repository? Read
Expand All @@ -231,11 +232,7 @@ can [read more about extensions here][ohif-extensions].

| Name | Description | Links |
| -------------------------------------------------------------- | ------------------------------------------------------- | ---------------------- |
| [@ohif/extension-cornestone][extension-cornerstone] | 2D image viewing, annotation, and segementation tools | [NPM][cornerstone-npm] |
| [@ohif/extension-dicom-html][extension-dicom-html] | Support for viewing DICOM SR as rendered HTML | [NPM][html-npm] |
| [@ohif/extension-dicom-microscopy][extension-dicom-microscopy] | Whole slide microscopy viewing | [NPM][microscopy-npm] |
| [@ohif/extension-dicom-pdf][extension-dicom-pdf] | View DICOM wrapped PDFs in a viewport | [NPM][pdf-npm] |
| [@ohif/extension-vtk][extension-vtk] | Volume rendering, reconstruction, and 3D visualizations | [NPM][vtk-npm] |
| [@ohif/extension-cornerstone][extension-cornerstone] | 2D image viewing, annotation, and segementation tools | [NPM][cornerstone-npm] |

## Acknowledgments

Expand Down
17 changes: 0 additions & 17 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,3 @@ module.exports = {
},
},
};

// TODO: Plugins; Aliases
// We don't currently use aliases, but this is a nice snippet that would help
// [
// 'module-resolver',
// {
// // https://github.com/tleunen/babel-plugin-module-resolver/issues/338
// // There seem to be a bug with module-resolver with a mono-repo setup:
// // It doesn't resolve paths correctly when using root/alias combo, so we
// // use this function instead.
// resolvePath(sourcePath, currentFile, opts) {
// // This will return undefined if aliases has no key for the sourcePath,
// // in which case module-resolver will fallback on its default behaviour.
// return aliases[sourcePath];
// },
// },
// ],
6 changes: 5 additions & 1 deletion docs/latest/book.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
"text": "Version 1.0.0 (Meteor)"
},
{
"value": "https://docs.ohif.org/",
"value": "https://docs.ohif.org/history/v2/",
"text": "Version 2.0.0",
},
{
"value": "https://docs.ohif.org/",
"text": "Version 3.0.0",
"selected": true
}
]
Expand Down
6 changes: 5 additions & 1 deletion docs/v1/book.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
"selected": true
},
{
"value": "https://docs.ohif.org/",
"value": "https://docs.ohif.org/history/v2/",
"text": "Version 2.0.0"
},
{
"value": "https://docs.ohif.org/",
"text": "Version 3.0.0"
}
]
}
Expand Down
Empty file added docs/v2/.nojekyll
Empty file.
Loading

0 comments on commit 0db81b3

Please sign in to comment.