-
Notifications
You must be signed in to change notification settings - Fork 24
50 lines (49 loc) · 1.73 KB
/
storybook-visual.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: "Storybook Visual"
on:
workflow_call:
jobs:
update-screenshots:
defaults:
run:
working-directory: ui
shell: bash
runs-on: ubuntu-22.04
env:
isPR: ${{ github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main' }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.ref }}
- name: install deps
uses: ./.github/actions/cached-ui-deps
- name: Install Playwright
run: yarn playwright install
- name: Build Storybook
run: yarn build-storybook --quiet
- name: Serve Storybook and update screenshots
run: |
npx concurrently --kill-others --success first -n "SB,TEST" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn test-storybook ${{ env.isPR && '-u' || ''}}"
- name: Import GPG key
if: ${{ env.isPR }}
uses: crazy-max/ghaction-import-gpg@v6
with:
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Push updated screenshots
if: ${{ env.isPR }}
run: |
git add \*.png
git diff --staged --exit-code || (git commit -S -m "update screenshots" && git push)
- uses: actions/upload-artifact@v4
name: "Upload test report"
if: ${{ failure() }}
with:
name: storybook-tests-report
path: ui/test-reports/