veza/.github/workflows/storybook-audit.yml

53 lines
1.3 KiB
YAML

# Storybook audit: build static Storybook, serve it, run the audit script.
# Fails the job if any story has console errors, page errors, or unhandled network failures.
# See docs/STORYBOOK_CONTRACT.md and apps/web/scripts/audit-storybook.js.
name: Storybook Audit
on:
push:
paths:
- "apps/web/**"
- ".github/workflows/storybook-audit.yml"
pull_request:
paths:
- "apps/web/**"
- ".github/workflows/storybook-audit.yml"
workflow_dispatch:
jobs:
audit:
name: Build & audit Storybook
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/web
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: apps/web/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npm run build-storybook
env:
VITE_API_URL: /api/v1
VITE_USE_MSW: "true"
VITE_STORYBOOK: "true"
- name: Install Playwright Chromium
run: npx playwright install chromium --with-deps
- name: Serve Storybook and run audit
run: |
npx serve -s storybook-static -p 6007 &
sleep 5
node scripts/audit-storybook.js