Skip to content

chore: bugbot

chore: bugbot #11063

name: "Storybook Tests"
on:
pull_request:
push:
branches:
- "main"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Detect which projects have changed
detect-changes:
uses: ./.github/workflows/_check-workspaces-changes.yaml
test:
needs: detect-changes
name: "[⚛️ REACT] Storybook Tests"
if: |
needs.detect-changes.outputs.package_react == 'true' &&
github.head_ref != 'release-please--branches--master' &&
!contains(github.event.pull_request.labels.*.name, 'autorelease')
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node-pnpm
- name: Get Playwright version
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(pnpm why @playwright/test -r --json | jq -r '.[] | select(.devDependencies["@playwright/test"]) | .devDependencies["@playwright/test"].version')
echo "PLAYWRIGHT_VERSION: $PLAYWRIGHT_VERSION"
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ steps.playwright-version.outputs.version }}-${{ runner.os }}
restore-keys: |
playwright-browsers-${{ steps.playwright-version.outputs.version }}-
playwright-browsers-
- name: Install Playwright
run: |
pnpx playwright@${{ steps.playwright-version.outputs.version }} install --with-deps
- name: Build Storybook
run: |
pnpm --filter @factorialco/f0-core build
pnpm --filter @factorialco/f0-react run build-storybook --quiet
- name: Serve Storybook and run tests
env:
DEBUG: vite
VITEST_LOG_LEVEL: debug
run: |
pnpx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"pnpx http-server packages/react/storybook-static --port 6006 --silent" \
"pnpx wait-on http://localhost:6006 --timeout 60000 && sleep 2 && pnpm --filter @factorialco/f0-react test-storybook"