Skip to content

chore: update dependency @types/react to v19 #2944

chore: update dependency @types/react to v19

chore: update dependency @types/react to v19 #2944

name: visual regression test
on:
push:
branches:
- main
pull_request_target:
paths:
- 'packages/spindle-ui/**'
workflow_dispatch:
permissions:
contents: read
jobs:
check_condition:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
result: ${{ steps.condition.outputs.result }}
steps:
- name: default to not running
run: echo 'RESULT=false' >> "$GITHUB_ENV"
- name: execute if triggered by members
if: >
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch'
run: echo 'RESULT=true' >> "$GITHUB_ENV"
- name: execute if the PR from a forked repository, it have the [allow execute workflow] label
if: >
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
contains(github.event.pull_request.labels.*.name, 'allow execute workflow')
run: echo 'RESULT=true' >> "$GITHUB_ENV"
- name: execute if the PR from a this repository
if: >
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name == github.repository
run: echo 'RESULT=true' >> "$GITHUB_ENV"
- id: condition
run: echo "result=${RESULT}" >> "$GITHUB_OUTPUT"
visual_regression_test:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: check_condition
if: needs.check_condition.outputs.result == 'true'
steps:
- run: sudo apt-get --yes update
- run: sudo apt-get --yes install fonts-noto
- if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'refs/pull/${{ github.event.number }}/merge'
- if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: restore lerna
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ github.event_name }}-${{ hashFiles('**/yarn.lock') }}-v2
- run: yarn install --frozen-lockfile
- run: |
yarn lerna run --scope @openameba/spindle-hooks build
yarn lerna run --scope @openameba/spindle-ui storybook:build
- name: capture stories
run: >
npx storycap
--outDir packages/spindle-ui/.reg-suit/actual_images/
--serverCmd 'npx serve -p 5000 packages/spindle-ui/public'
http://localhost:5000
- name: workaround for detached HEAD
run: git checkout ${{ github.head_ref || github.ref_name }}
- run: |
printf -- '%s' "$GOOGLE_APPLICATION_CREDENTIALS_JSON" | base64 --decode > "${PWD}/storage-key.json"
export GOOGLE_APPLICATION_CREDENTIALS="${PWD}/storage-key.json"
yarn lerna run --scope @openameba/spindle-ui test:regression
env:
GCS_BUCKET_NAME_REG_SUIT: ${{ secrets.GCS_BUCKET_NAME_REG_SUIT }}
GOOGLE_APPLICATION_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}
REG_SUIT_NOTIFY_CLIENT_ID: ${{ secrets.REG_SUIT_NOTIFY_CLIENT_ID }}