Angular 19 #4914
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration and Delivery | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
NODE_VERSION: 20.14.0 | |
jobs: | |
install: | |
name: 'Installing NPM modules' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Caching NPM modules if necessary' | |
uses: actions/cache@v4 | |
id: node-modules-cache | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
lint: | |
name: 'Linting' | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- run: npm run lint | |
build-libs: | |
name: 'Building Libs' | |
needs: install | |
runs-on: ubuntu-latest | |
outputs: | |
workbench-version: ${{ steps.workbench-package-json.outputs.version }} | |
workbench-client-version: ${{ steps.workbench-client-package-json.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Reading package.json version of scion/workbench' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/package-json@master | |
id: workbench-package-json | |
with: | |
path: projects/scion/workbench/package.json | |
- name: 'Reading package.json version of scion/workbench-client' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/package-json@master | |
id: workbench-client-package-json | |
with: | |
path: projects/scion/workbench-client/package.json | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: 'Building @scion/workbench-client' | |
run: npm run workbench-client:build | |
- name: 'Uploading dist/scion/workbench-client' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: workbench-client-dist | |
path: dist/scion/workbench-client | |
- name: 'Building @scion/workbench' | |
run: npm run workbench:build | |
- name: 'Uploading dist/scion/workbench' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: workbench-dist | |
path: dist/scion/workbench | |
- name: 'Building TypeDoc for @scion/workbench-client' | |
run: npm run workbench-client:typedoc | |
- name: 'Uploading dist/workbench-client-api' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: workbench-client-api | |
path: dist/workbench-client-api | |
build-apps: | |
name: 'Building Apps' | |
needs: build-libs | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: | |
- name: workbench-testing-app-ci | |
cmd: npm run workbench-testing-app:ci:build | |
- name: workbench-testing-app-basehref | |
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-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-getting-started-app | |
cmd: npm run workbench-getting-started-app:build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: 'Downloading dist/scion/workbench' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-dist | |
path: dist/scion/workbench | |
- name: 'Downloading dist/scion/workbench-client' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-client-dist | |
path: dist/scion/workbench-client | |
- name: 'Building ${{ matrix.app.name }}' | |
run: ${{ matrix.app.cmd }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.app.name }} | |
path: dist/${{ matrix.app.name }} | |
test: | |
name: 'Unit Testing' | |
needs: build-libs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Downloading dist/scion/workbench' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-dist | |
path: dist/scion/workbench | |
- name: 'Downloading dist/scion/workbench-client' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-client-dist | |
path: dist/scion/workbench-client | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- run: npm run test:headless | |
e2e: | |
name: 'E2E Testing' | |
needs: [ build-libs, build-apps ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
shard: [ 1/15, 2/15, 3/15, 4/15, 5/15, 6/15, 7/15, 8/15, 9/15, 10/15, 11/15, 12/15, 13/15, 14/15, 15/15 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: 'Downloading dist/scion/workbench' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-dist | |
path: dist/scion/workbench | |
- name: 'Downloading dist/scion/workbench-client' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-client-dist | |
path: dist/scion/workbench-client | |
- name: 'Downloading app: workbench-testing-app-ci (dist)' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-testing-app-ci | |
path: dist/workbench-testing-app-ci | |
- name: 'Downloading app: workbench-testing-app-basehref (dist)' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-testing-app-basehref | |
path: dist/workbench-testing-app-basehref | |
- name: 'Downloading app: workbench-testing-app-basehref-webpack (dist)' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-testing-app-basehref-webpack | |
path: dist/workbench-testing-app-basehref-webpack | |
- name: 'Downloading app: workbench-client-testing-app-ci (dist)' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-client-testing-app-ci | |
path: dist/workbench-client-testing-app-ci | |
- name: 'Restoring NPM modules from cache' | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- run: npm run e2e:headless -- --shard=${{ matrix.shard }} | |
workbench-release-guard: | |
name: 'Should release @scion/workbench?' | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- build-libs | |
- build-apps | |
- lint | |
- test | |
- e2e | |
runs-on: ubuntu-latest | |
outputs: | |
should-release: ${{ steps.tag-release-commit.outputs.is-release-commit }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'If release commit present, add release tag' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/tag-release-commit@master | |
id: tag-release-commit | |
with: | |
release-commit-message-pattern: 'release\(workbench\): v(.*)' | |
expected-version: ${{ needs.build-libs.outputs.workbench-version }} | |
workbench-client-release-guard: | |
name: 'Should release @scion/workbench-client?' | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- build-libs | |
- build-apps | |
- lint | |
- test | |
- e2e | |
runs-on: ubuntu-latest | |
outputs: | |
should-release: ${{ steps.tag-release-commit.outputs.is-release-commit }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'If release commit present, add release tag' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/tag-release-commit@master | |
id: tag-release-commit | |
with: | |
release-commit-message-pattern: 'release\(workbench-client\): v(.*)' | |
expected-version: ${{ needs.build-libs.outputs.workbench-client-version }} | |
git-tag: workbench-client-%v | |
deploy-apps: | |
name: 'Deploying Applications' | |
if: github.ref == 'refs/heads/master' | |
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-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-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-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 (latest)' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master | |
with: | |
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 (latest)' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master | |
with: | |
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 | |
- 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: | |
dist-folder: dist/workbench-getting-started-app/browser | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
org-id: ${{ secrets.VERCEL_ORG_ID }} | |
project-id: ${{ secrets.VERCEL_WORKBENCH_GETTING_STARTED_APP_PROJECT_ID }} | |
aliases: workbench-getting-started.scion.vercel.app | |
release-workbench: | |
name: 'Releasing @scion/workbench' | |
if: ${{ needs.workbench-release-guard.outputs.should-release == 'true' }} | |
needs: | |
- build-libs | |
- workbench-release-guard | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Downloading dist/scion/workbench' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-dist | |
path: dist/scion/workbench | |
- name: 'Publishing @scion/workbench to NPM' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/npm-publish@master | |
with: | |
dist-folder: dist/scion/workbench | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
dry-run: false | |
- name: 'Creating GitHub Release' | |
run: gh release create $VERSION --title "$VERSION (@scion/workbench)" --notes-file CHANGELOG_WORKBENCH_LATEST.md --verify-tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ needs.build-libs.outputs.workbench-version }} | |
release-workbench-client: | |
name: 'Releasing @scion/workbench-client' | |
if: ${{ needs.workbench-client-release-guard.outputs.should-release == 'true' }} | |
needs: | |
- build-libs | |
- workbench-client-release-guard | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Downloading dist/scion/workbench-client' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-client-dist | |
path: dist/scion/workbench-client | |
- name: 'Downloading dist/workbench-client-api' | |
uses: actions/download-artifact@v4 | |
with: | |
name: workbench-client-api | |
path: dist/workbench-client-api | |
- name: 'Publishing TypeDoc for @scion/workbench-client to Vercel' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/vercel-deploy@master | |
with: | |
dist-folder: dist/workbench-client-api | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
org-id: ${{ secrets.VERCEL_ORG_ID }} | |
project-id: ${{ secrets.VERCEL_WORKBENCH_CLIENT_API_PROJECT_ID }} | |
version: ${{ needs.build-libs.outputs.workbench-client-version }} | |
aliases: | | |
workbench-client-api.scion.vercel.app, | |
workbench-client-api-v%v.scion.vercel.app | |
- name: 'Publishing @scion/workbench-client to NPM' | |
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/npm-publish@master | |
with: | |
dist-folder: dist/scion/workbench-client | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
dry-run: false | |
- name: 'Creating GitHub Release' | |
run: gh release create workbench-client-$VERSION --title "$VERSION (@scion/workbench-client)" --notes-file CHANGELOG_WORKBENCH_CLIENT_LATEST.md --verify-tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ needs.build-libs.outputs.workbench-client-version }} |