Skip to content

perf(components/viewport): avoid change detection cycle when scrollin… #1404

perf(components/viewport): avoid change detection cycle when scrollin…

perf(components/viewport): avoid change detection cycle when scrollin… #1404

Workflow file for this run

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:
toolkit-version: ${{ steps.toolkit-package-json.outputs.version }}
components-version: ${{ steps.components-package-json.outputs.version }}
components-internal-version: ${{ steps.components-internal-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/toolkit'
uses: ./.github/actions/package-json
id: toolkit-package-json
with:
path: projects/scion/toolkit/package.json
- name: 'Reading package.json version of scion/components'
uses: ./.github/actions/package-json
id: components-package-json
with:
path: projects/scion/components/package.json
- name: 'Reading package.json version of scion/components.internal'
uses: ./.github/actions/package-json
id: components-internal-package-json
with:
path: projects/scion/components.internal/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/toolkit'
run: npm run toolkit:build
- name: 'Uploading dist/scion/toolkit'
uses: actions/upload-artifact@v4
with:
name: toolkit-dist
path: dist/scion/toolkit
- name: 'Building @scion/components'
run: npm run components:build
- name: 'Uploading dist/scion/components'
uses: actions/upload-artifact@v4
with:
name: components-dist
path: dist/scion/components
- name: 'Building @scion/components.internal'
run: npm run components.internal:build
- name: 'Uploading dist/scion/components.internal'
uses: actions/upload-artifact@v4
with:
name: components-internal-dist
path: dist/scion/components.internal
build-apps:
name: 'Building Apps'
needs: build-libs
runs-on: ubuntu-latest
strategy:
matrix:
app:
- name: components-app
cmd: npm run components-app:build
- name: components-testing-app
cmd: npm run components-testing-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/toolkit'
uses: actions/download-artifact@v4
with:
name: toolkit-dist
path: dist/scion/toolkit
- name: 'Downloading dist/scion/components'
uses: actions/download-artifact@v4
with:
name: components-dist
path: dist/scion/components
- name: 'Downloading dist/scion/components.internal'
uses: actions/download-artifact@v4
with:
name: components-internal-dist
path: dist/scion/components.internal
- 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: '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/toolkit'
uses: actions/download-artifact@v4
with:
name: toolkit-dist
path: dist/scion/toolkit
- name: 'Downloading dist/scion/components'
uses: actions/download-artifact@v4
with:
name: components-dist
path: dist/scion/components
- name: 'Downloading dist/scion/components.internal'
uses: actions/download-artifact@v4
with:
name: components-internal-dist
path: dist/scion/components.internal
- run: npm run test:headless
e2e:
name: 'E2E Testing'
needs: [ build-libs, build-apps ]
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/1]
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/components-testing-app'
uses: actions/download-artifact@v4
with:
name: components-testing-app
path: dist/components-testing-app
- run: npm run e2e:headless -- --shard=${{ matrix.shard }}
toolkit-release-guard:
name: 'Should release @scion/toolkit?'
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\(toolkit\): v(.*)'
expected-version: ${{ needs.build-libs.outputs.toolkit-version }}
git-tag: toolkit-%v
components-release-guard:
name: 'Should release @scion/components?'
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\(components\): v(.*)'
expected-version: ${{ needs.build-libs.outputs.components-version }}
git-tag: components-%v
components-internal-release-guard:
name: 'Should release @scion/components.internal?'
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\(ɵcomponents\): v(.*)'
expected-version: ${{ needs.build-libs.outputs.components-internal-version }}
git-tag: ɵcomponents-%v
deploy-components-app:
name: 'Deploying components application'
if: github.ref == 'refs/heads/master'
needs:
- build-libs
- build-apps
- lint
- test
- e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading dist/components-app'
uses: actions/download-artifact@v4
with:
name: components-app
path: dist/components-app
- name: 'Deploying components application to Vercel'
uses: ./.github/actions/vercel-deploy
with:
dist-folder: dist/components-app/browser
vercel-token: ${{ secrets.VERCEL_TOKEN }}
org-id: ${{ secrets.VERCEL_ORG_ID }}
project-id: ${{ secrets.VERCEL_COMPONENTS_PROJECT_ID }}
version: ${{ needs.build-libs.outputs.components-version }}
aliases: |
components.scion.vercel.app,
components-v%v.scion.vercel.app,
release-toolkit:
name: 'Releasing @scion/toolkit'
if: ${{ needs.toolkit-release-guard.outputs.should-release == 'true' }}
needs:
- build-libs
- toolkit-release-guard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading dist/scion/toolkit'
uses: actions/download-artifact@v4
with:
name: toolkit-dist
path: dist/scion/toolkit
- name: 'Publishing @scion/toolkit to NPM'
uses: ./.github/actions/npm-publish
with:
dist-folder: dist/scion/toolkit
npm-token: ${{ secrets.NPM_TOKEN }}
dry-run: false
- name: 'Creating GitHub Release'
run: gh release create toolkit-$VERSION --title "$VERSION (@scion/toolkit)" --notes-file CHANGELOG_TOOLKIT_LATEST.md --verify-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.build-libs.outputs.toolkit-version }}
release-components:
name: 'Releasing @scion/components'
if: ${{ needs.components-release-guard.outputs.should-release == 'true' }}
needs:
- build-libs
- components-release-guard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading dist/scion/components'
uses: actions/download-artifact@v4
with:
name: components-dist
path: dist/scion/components
- name: 'Publishing @scion/components to NPM'
uses: ./.github/actions/npm-publish
with:
dist-folder: dist/scion/components
npm-token: ${{ secrets.NPM_TOKEN }}
dry-run: false
- name: 'Creating GitHub Release'
run: gh release create components-$VERSION --title "$VERSION (@scion/components)" --notes-file CHANGELOG_COMPONENTS_LATEST.md --verify-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.build-libs.outputs.components-version }}
release-components-internal:
name: 'Releasing @scion/components.internal'
if: ${{ needs.components-internal-release-guard.outputs.should-release == 'true' }}
needs: components-internal-release-guard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading dist/scion/components.internal'
uses: actions/download-artifact@v4
with:
name: components-internal-dist
path: dist/scion/components.internal
- name: 'Publishing @scion/components.internal to NPM'
uses: ./.github/actions/npm-publish
with:
dist-folder: dist/scion/components.internal
npm-token: ${{ secrets.NPM_TOKEN }}
dry-run: false