Skip to content

Commit

Permalink
ci(workbench-testing-app): set up versioned deployment of testing app
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwiehl committed Oct 31, 2024
1 parent 70cb418 commit 70b1544
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 24 deletions.
71 changes: 55 additions & 16 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ jobs:
cmd: npm run workbench-testing-app:basehref:build
- name: workbench-testing-app-basehref-webpack
cmd: npm run workbench-testing-app:basehref-webpack:build
- name: workbench-testing-app-vercel
cmd: npm run workbench-testing-app:vercel:build
- name: workbench-testing-app-vercel-latest
cmd: npm run workbench-testing-app:vercel-latest:build
- name: workbench-testing-app-vercel-release
cmd: npm run workbench-testing-app:vercel-release:build
- name: workbench-client-testing-app-vercel-latest
cmd: npm run workbench-client-testing-app:vercel-latest:build
- name: workbench-client-testing-app-vercel-release
cmd: npm run workbench-client-testing-app:vercel-release:build
- name: workbench-client-testing-app-ci
cmd: npm run workbench-client-testing-app:ci:build
- name: workbench-client-testing-app-vercel
cmd: npm run workbench-client-testing-app:vercel:build
- name: workbench-getting-started-app
cmd: npm run workbench-getting-started-app:build
steps:
Expand Down Expand Up @@ -246,43 +250,78 @@ jobs:
deploy-apps:
name: 'Deploying Applications'
if: github.ref == 'refs/heads/master'
needs: [ workbench-release-guard, workbench-client-release-guard ]
needs:
- workbench-release-guard
- workbench-client-release-guard
- build-libs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading app: workbench-testing-app-vercel (dist)'
- name: 'Downloading app: workbench-testing-app-vercel-latest (dist)'
uses: actions/download-artifact@v4
with:
name: workbench-testing-app-vercel-latest
path: dist/workbench-testing-app-vercel-latest
- name: 'Downloading app: workbench-client-testing-app-vercel-latest (dist)'
uses: actions/download-artifact@v4
with:
name: workbench-client-testing-app-vercel-latest
path: dist/workbench-client-testing-app-vercel-latest
- name: 'Downloading app: workbench-testing-app-vercel-release (dist)'
uses: actions/download-artifact@v4
with:
name: workbench-testing-app-vercel
path: dist/workbench-testing-app-vercel
- name: 'Downloading app: workbench-client-testing-app-vercel (dist)'
name: workbench-testing-app-vercel-release
path: dist/workbench-testing-app-vercel-release
- name: 'Downloading app: workbench-client-testing-app-vercel-release (dist)'
uses: actions/download-artifact@v4
with:
name: workbench-client-testing-app-vercel
path: dist/workbench-client-testing-app-vercel
name: workbench-client-testing-app-vercel-release
path: dist/workbench-client-testing-app-vercel-release
- name: 'Downloading app: workbench-getting-started-app (dist)'
uses: actions/download-artifact@v4
with:
name: workbench-getting-started-app
path: dist/workbench-getting-started-app
- name: 'Deploying workbench-testing-app to Vercel'
- name: 'Deploying workbench-testing-app to Vercel (latest)'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/workbench-testing-app-vercel/browser
dist-folder: dist/workbench-testing-app-vercel-latest/browser
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_WORKBENCH_TESTING_APP_PROJECT_ID }}
aliases: workbench-testing-app.scion.vercel.app
- name: 'Deploying workbench-client-testing-app to Vercel'
- name: 'Deploying workbench-client-testing-app to Vercel (latest)'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/workbench-client-testing-app-vercel/browser
dist-folder: dist/workbench-client-testing-app-vercel-latest/browser
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_WORKBENCH_CLIENT_TESTING_APP_PROJECT_ID }}
aliases: |
workbench-client-testing-app1.scion.vercel.app,
workbench-client-testing-app2.scion.vercel.app,
workbench-client-testing-app2.scion.vercel.app
- name: 'Deploying workbench-testing-app to Vercel (release)'
if: ${{ needs.workbench-release-guard.outputs.should-release == 'true' || needs.workbench-client-release-guard.outputs.should-release == 'true' }}
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/workbench-testing-app-vercel-release/browser
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_WORKBENCH_TESTING_APP_PROJECT_ID }}
version: ${{ needs.build-libs.outputs.workbench-version }}
aliases: workbench-testing-app-v%v.scion.vercel.app
- name: 'Deploying workbench-client-testing-app to Vercel (release)'
if: ${{ needs.workbench-release-guard.outputs.should-release == 'true' || needs.workbench-client-release-guard.outputs.should-release == 'true' }}
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
dist-folder: dist/workbench-client-testing-app-vercel-release/browser
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_WORKBENCH_CLIENT_TESTING_APP_PROJECT_ID }}
version: ${{ needs.build-libs.outputs.workbench-version }}
aliases: |
workbench-client-testing-app1-v%v.scion.vercel.app,
workbench-client-testing-app2-v%v.scion.vercel.app
- name: 'Deploying workbench-getting-started-app to Vercel'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master
with:
Expand Down
56 changes: 50 additions & 6 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"scripts": []
},
"configurations": {
"production-vercel": {
"production-vercel-latest": {
"budgets": [
{
"type": "initial",
Expand All @@ -267,11 +267,33 @@
"fileReplacements": [
{
"replace": "apps/workbench-testing-app/src/environments/environment.ts",
"with": "apps/workbench-testing-app/src/environments/environment.vercel.ts"
"with": "apps/workbench-testing-app/src/environments/environment.vercel.latest.ts"
}
],
"outputHashing": "all",
"outputPath": "dist/workbench-testing-app-vercel"
"outputPath": "dist/workbench-testing-app-vercel-latest"
},
"production-vercel-release": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "5kB"
}
],
"fileReplacements": [
{
"replace": "apps/workbench-testing-app/src/environments/environment.ts",
"with": "apps/workbench-testing-app/src/environments/environment.vercel.release.ts"
}
],
"outputHashing": "all",
"outputPath": "dist/workbench-testing-app-vercel-release"
},
"production-ci": {
"budgets": [
Expand Down Expand Up @@ -481,7 +503,7 @@
"scripts": []
},
"configurations": {
"production-vercel": {
"production-vercel-latest": {
"budgets": [
{
"type": "initial",
Expand All @@ -497,11 +519,33 @@
"fileReplacements": [
{
"replace": "apps/workbench-client-testing-app/src/environments/environment.ts",
"with": "apps/workbench-client-testing-app/src/environments/environment.vercel.ts"
"with": "apps/workbench-client-testing-app/src/environments/environment.vercel.latest.ts"
}
],
"outputHashing": "all",
"outputPath": "dist/workbench-client-testing-app-vercel-latest"
},
"production-vercel-release": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "5kB"
}
],
"fileReplacements": [
{
"replace": "apps/workbench-client-testing-app/src/environments/environment.ts",
"with": "apps/workbench-client-testing-app/src/environments/environment.vercel.release.ts"
}
],
"outputHashing": "all",
"outputPath": "dist/workbench-client-testing-app-vercel"
"outputPath": "dist/workbench-client-testing-app-vercel-release"
},
"production-ci": {
"budgets": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2018-2022 Swiss Federal Railways
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/

import packageJson from '../../../../projects/scion/workbench/package.json';

const version = packageJson.version.replace(/\./g, '-');

/**
* Environment used when packaging the app for Vercel.
*/
export const environment = {
animationEnabled: true,
apps: {
app1: {
symbolicName: 'workbench-client-testing-app1',
url: `https://workbench-client-testing-app1-v${version}.scion.vercel.app`,
},
app2: {
symbolicName: 'workbench-client-testing-app2',
url: `https://workbench-client-testing-app2-v${version}.scion.vercel.app`,
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2018-2022 Swiss Federal Railways
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/

import {MicrofrontendPlatformConfig} from '@scion/microfrontend-platform';
import {workbenchManifest} from '../app/workbench.manifest';
import packageJson from '../../../../projects/scion/workbench/package.json';

const version = packageJson.version.replace(/\./g, '-');

/**
* Environment used when packaging the app for Vercel.
*/
const microfrontendPlatformConfig: MicrofrontendPlatformConfig = {
host: {
symbolicName: 'workbench-host-app',
manifest: workbenchManifest,
},
applications: [
{symbolicName: 'workbench-client-testing-app1', manifestUrl: `https://workbench-client-testing-app1-v${version}.scion.vercel.app/manifest-app1.json`, intentionRegisterApiDisabled: false},
{symbolicName: 'workbench-client-testing-app2', manifestUrl: `https://workbench-client-testing-app2-v${version}.scion.vercel.app/manifest-app2.json`, intentionRegisterApiDisabled: false},
{symbolicName: 'devtools', manifestUrl: 'https://microfrontend-platform-devtools-v1-3-1.scion.vercel.app/manifest.json', intentionCheckDisabled: true, scopeCheckDisabled: true},
],
};

export const environment = {
animationEnabled: true,
logAngularChangeDetectionCycles: false,
microfrontendPlatformConfig,
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"workbench-getting-started-app:serve": "ng serve workbench-getting-started-app --port 4500",

"workbench-testing-app:build": "ng build workbench-testing-app --configuration=development",
"workbench-testing-app:vercel:build": "ng build workbench-testing-app --configuration=production-vercel",
"workbench-testing-app:vercel-latest:build": "ng build workbench-testing-app --configuration=production-vercel-latest",
"workbench-testing-app:vercel-release:build": "ng build workbench-testing-app --configuration=production-vercel-release",
"workbench-testing-app:ci:build": "ng build workbench-testing-app --configuration=production-ci",
"workbench-testing-app:basehref:build": "ng build workbench-testing-app --configuration=production-basehref",
"workbench-testing-app:basehref-webpack:build": "ng run workbench-testing-app:build-basehref-webpack:production",
Expand All @@ -59,7 +60,8 @@
"workbench-testing-app:basehref-webpack:http-server": "cd dist/workbench-testing-app-basehref-webpack && http-server --silent --port 4400",

"workbench-client-testing-app:build": "ng build workbench-client-testing-app --configuration=development",
"workbench-client-testing-app:vercel:build": "ng build workbench-client-testing-app --configuration=production-vercel",
"workbench-client-testing-app:vercel-latest:build": "ng build workbench-client-testing-app --configuration=production-vercel-latest",
"workbench-client-testing-app:vercel-release:build": "ng build workbench-client-testing-app --configuration=production-vercel-release",
"workbench-client-testing-app:ci:build": "ng build workbench-client-testing-app --configuration=production-ci",
"workbench-client-testing-app:lint": "ng lint workbench-client-testing-app",
"workbench-client-testing-app:4201:serve": "ng serve workbench-client-testing-app --port 4201",
Expand Down

0 comments on commit 70b1544

Please sign in to comment.