ci: GCP deploy (#810)

* ci: test docs-publish

* Require unit tests for dry run

* ci: Make sure our docs publish is executable

* Try to correct path issue

* Try repo prefix

* Try as yarn command

* Need a workspace to attach to from previous step

* Add before we call our bash script

* See if we can enforce commands being available -- or just install locally?

* Try again

* Try SSH

* Include username in gh https url

* Note regarding failure on PR branches

* Remove docs publish from PR workflow

* chore: ability to specify an alternative html-template at build time

* chore: add command to build demo PWA website output

* chore: remove unused CI code

* Testing GCP capabilities

* syntax

* Naming

* naming

* chore: WebPack output progress that we care about

* chore: Only publish the app config we care about

* PWA should publish source map

* Unused index.html file

* chore: Remove unused copy-webpack-plugin ignore

* Don't generate source map until we resolve memory issue

* ci: attempt to publish with GCP bucket deploy
This commit is contained in:
Danny Brown 2019-08-27 14:43:44 -04:00 committed by GitHub
parent 073c0af7f7
commit 619d363243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 64 deletions

View File

@ -231,7 +231,6 @@ jobs:
name: 'Build Demo Site, Upload SourceMaps, Send Deploy Notification' name: 'Build Demo Site, Upload SourceMaps, Send Deploy Notification'
command: | command: |
npx lerna run build:viewer:demo --stream npx lerna run build:viewer:demo --stream
# perl -i -pe 's#</head>#`cat .circleci/rollbar.html` #e' build/index.html
# export FILE_1=$(find ./build/static/js -type f -name "2.*.js" -exec basename {} \;) # export FILE_1=$(find ./build/static/js -type f -name "2.*.js" -exec basename {} \;)
# export FILE_MAIN=$(find ./build/static/js -type f -name "main.*.js" -exec basename {} \;) # export FILE_MAIN=$(find ./build/static/js -type f -name "main.*.js" -exec basename {} \;)
# export FILE_RUNTIME_MAIN=$(find ./build/static/js -type f -name "runtime~main.*.js" -exec basename {} \;) # export FILE_RUNTIME_MAIN=$(find ./build/static/js -type f -name "runtime~main.*.js" -exec basename {} \;)
@ -254,18 +253,15 @@ jobs:
- setup_remote_docker: - setup_remote_docker:
docker_layer_caching: true docker_layer_caching: true
- run: - run:
name: Node Test name: Deploy latest version to viewer.ohif.org
command: npx lerna run build:viewer:demo --stream command: |
# - run: # https://circleci.com/docs/2.0/google-auth/#authorization
# name: Deploy latest version to viewer.ohif.org echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
# command: | gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
# # https://circleci.com/docs/2.0/google-auth/#authorization gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
# echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=- # Remove all files in Storage Bucket; Push latest
# gcloud --quiet config set project ${GOOGLE_PROJECT_ID} gsutil -m rm gs://$GOOGLE_STORAGE_BUCKET/**
# gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE} gsutil -m rsync -R platform/viewer/dist gs://$GOOGLE_STORAGE_BUCKET
# # Remove all files in Storage Bucket; Push latest
# gsutil -m rm gs://$GOOGLE_STORAGE_BUCKET/**
# gsutil -m rsync -R platform/viewer/dist gs://$GOOGLE_STORAGE_BUCKET
workflows: workflows:
version: 2 version: 2

View File

@ -23,6 +23,8 @@ module.exports = (env, argv) => {
return merge(commonConfig, { return merge(commonConfig, {
// https://webpack.js.org/configuration/mode/#mode-production // https://webpack.js.org/configuration/mode/#mode-production
mode: 'production', mode: 'production',
// Out of memory -- Code Split
// devtool: 'source-map',
stats: { stats: {
colors: true, colors: true,
hash: true, hash: true,
@ -47,7 +49,12 @@ module.exports = (env, argv) => {
// merging with this? // merging with this?
plugins: [ plugins: [
// Longer build. Let's report progress // Longer build. Let's report progress
new webpack.ProgressPlugin(), new webpack.ProgressPlugin({
entries: false,
modules: false,
modulesCount: 500,
profile: true,
}),
// Clean output.path // Clean output.path
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
// "Public" Folder // "Public" Folder
@ -57,7 +64,13 @@ module.exports = (env, argv) => {
to: DIST_DIR, to: DIST_DIR,
toType: 'dir', toType: 'dir',
// Ignore our HtmlWebpackPlugin template file // Ignore our HtmlWebpackPlugin template file
ignore: ['index.html', 'html-templates/*', '.DS_Store'], // Ignore our configuration files
ignore: ['config/*', 'html-templates/*', '.DS_Store'],
},
// Copy over and rename our target app config file
{
from: `${PUBLIC_DIR}/${APP_CONFIG}`,
to: `${DIST_DIR}/app-config.js`,
}, },
]), ]),
new ExtractCssChunksPlugin({ new ExtractCssChunksPlugin({
@ -74,7 +87,6 @@ module.exports = (env, argv) => {
filename: 'index.html', filename: 'index.html',
templateParameters: { templateParameters: {
PUBLIC_URL: PUBLIC_URL, PUBLIC_URL: PUBLIC_URL,
APP_CONFIG: APP_CONFIG,
}, },
// favicon: `${PUBLIC_DIR}/favicon.ico`, // favicon: `${PUBLIC_DIR}/favicon.ico`,
}), }),

View File

@ -8,11 +8,8 @@
/> />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<link rel="manifest" href="<%= PUBLIC_URL %>/manifest.json" /> <link rel="manifest" href="<%= PUBLIC_URL %>manifest.json" />
<script <script type="text/javascript" src="app-config.js"></script>
type="text/javascript"
src="<%= PUBLIC_URL %>/<%= APP_CONFIG %>"
></script>
<title>OHIF Viewer</title> <title>OHIF Viewer</title>

View File

@ -8,11 +8,8 @@
/> />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<link rel="manifest" href="<%= PUBLIC_URL %>/manifest.json" /> <link rel="manifest" href="<%= PUBLIC_URL %>manifest.json" />
<script <script type="text/javascript" src="app-config.js"></script>
type="text/javascript"
src="<%= PUBLIC_URL %>/<%= APP_CONFIG %>"
></script>
<title>OHIF Viewer</title> <title>OHIF Viewer</title>

View File

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="<%= PUBLIC_URL %>/manifest.json" />
<script
type="text/javascript"
src="<%= PUBLIC_URL %>/<%= APP_CONFIG %>"
></script>
<title>OHIF Viewer</title>
<!-- WEB FONTS -->
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700|Sanchez&display=swap"
rel="stylesheet"
/>
<!-- EXTENSIONS -->
<!-- <script type="text/javascript" src="path/to/some-extension.js"></script>
<script>
window.config.extensions = [SomeExtension];
</script> -->
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>