Hds-1742: build and publish hds-js package #4297
Workflow file for this run
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: development | |
on: | |
pull_request: | |
push: | |
branches: | |
- development | |
- master | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Read .nvmrc | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
id: nvmrc | |
- name: setup node ${{ steps.nvmrc.outputs.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '${{ steps.nvmrc.outputs.NODE_VERSION }}' | |
registry-url: 'https://registry.npmjs.org' | |
- name: install dependencies | |
run: | | |
yarn config set network-timeout 300000 | |
yarn | |
- name: build design tokens package | |
run: yarn build | |
working-directory: ./packages/design-tokens | |
- name: build core package | |
run: yarn build | |
working-directory: ./packages/core | |
- name: build react package | |
run: yarn build | |
working-directory: ./packages/react | |
- name: build hds-js package | |
run: yarn build:hds-js | |
working-directory: ./packages/react | |
- name: test react package | |
run: yarn test | |
working-directory: ./packages/react | |
- name: build storybook for react | |
if: ${{ !(contains(github.head_ref, 'hotfix') || contains(github.ref, 'hotfix')) }} | |
run: yarn build-storybook | |
working-directory: ./packages/react | |
- name: Store storybook as artifact | |
if: ${{ !(contains(github.head_ref, 'hotfix') || contains(github.ref, 'hotfix')) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: storybook-${{ github.sha }} | |
path: | | |
packages/react/.loki | |
packages/react/storybook-static | |
packages/react/.lokirc.json | |
retention-days: 1 | |
visual-tests: | |
needs: build-test | |
# No visual testing in hotfixes | |
if: ${{ !(contains(github.head_ref, 'hotfix') || contains(github.ref, 'hotfix')) }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
loki_configuration: ['laptop', 'iphone7'] | |
loki_test_group: ['Components/[A-M]', 'Components/[N-Z]'] | |
steps: | |
- name: download storybook | |
uses: actions/download-artifact@v4 | |
with: | |
name: storybook-${{ github.sha }} | |
- name: install dependencies for visual testing | |
run: | | |
sudo apt update | |
sudo apt install graphicsmagick -y | |
yarn add loki@0.30.3 | |
- name: Sanitize artifact name. Backslash not allowed | |
id: sanitize_artifact_name | |
run: echo ::set-output name=value::$(echo '${{ matrix.loki_test_group }}' | tr '/' '_') | |
- name: visually test react package with ${{ matrix.loki_configuration }} | |
run: ./node_modules/.bin/loki test --requireReference --verboseRenderer --reactUri file:./storybook-static --storiesFilter ${{ matrix.loki_test_group }} ${{ matrix.loki_configuration }} | |
- name: upload reference and actual images with ${{ matrix.loki_configuration }} and ${{ matrix.loki_test_group }} in case of failure | |
uses: actions/upload-artifact@v4 | |
with: | |
name: loki_images_${{ matrix.loki_configuration }}_${{ steps.sanitize_artifact_name.outputs.value }} | |
path: .loki/difference/*.* | |
if: failure() |