Skip to content

fix: use case line breaks #125

fix: use case line breaks

fix: use case line breaks #125

name: PR Health Checks
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
detect-changes:
name: Detect changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
code: ${{ steps.filter.outputs.code }}
should-skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- id: skip-check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5
with:
do_not_skip: '["workflow_dispatch"]'
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
if: steps.skip-check.outputs.should_skip != 'true'
with:
filters: |
code:
- 'library/**'
- 'standalone/**'
- 'package.json'
- 'package-lock.json'
- 'tsconfig*.json'
- '.github/workflows/pr-health-checks.yaml'
lint-and-format-check:
needs: [detect-changes]
if: needs.detect-changes.outputs.should-skip != 'true' && needs.detect-changes.outputs.code == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run Lint
run: npm run lint
- name: Check format
run: npm run format:check
- name: Check build
run: npm run build
- name: Run unit tests
run: npm run test
working-directory: library/
e2e-tests:
needs: [detect-changes]
if: needs.detect-changes.outputs.should-skip != 'true' && needs.detect-changes.outputs.code == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:lib
- name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium
working-directory: standalone/webapp/
- name: Install Playwright system deps
run: npx playwright install-deps chromium
working-directory: standalone/webapp/
- name: Run E2E tests
run: npx playwright test tests/e2e/
working-directory: standalone/webapp/
- name: Upload Playwright report
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-report-e2e
path: standalone/webapp/playwright-report/
retention-days: 14
- name: Upload Playwright test results
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-test-results-e2e
path: standalone/webapp/test-results/
retention-days: 14
# Visual regression tests — baselines MUST be generated inside the Playwright
# Docker container. See comment block below for regeneration instructions.
#
# To regenerate ALL baselines after UI changes, run from the repo root:
# docker run --rm -v "$(pwd)":/work -w /work --ipc=host \
# mcr.microsoft.com/playwright:v1.59.1-noble \
# bash -c "npm ci && npm run build:lib && cd standalone/webapp \
# && npx playwright test tests/visual/ --update-snapshots"
#
# To regenerate only SVG export baselines (works on any OS):
# cd standalone/webapp && npx playwright test tests/visual/svg-export --update-snapshots
visual-regression-tests:
needs: [detect-changes]
if: needs.detect-changes.outputs.should-skip != 'true' && needs.detect-changes.outputs.code == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: mcr.microsoft.com/playwright:v1.59.1-noble
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:lib
- name: Run visual regression tests
run: npx playwright test tests/visual/
working-directory: standalone/webapp/
- name: Upload Playwright report
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-report-visual
path: standalone/webapp/playwright-report/
retention-days: 14
- name: Upload Playwright test results
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-test-results-visual
path: standalone/webapp/test-results/
retention-days: 14
# Gate job — set this as the required status check in branch protection.
# Correctly handles skipped jobs (docs-only, duplicate runs).
pr-health-gate:
name: PR Health Gate
runs-on: ubuntu-latest
timeout-minutes: 2
needs:
[
detect-changes,
lint-and-format-check,
e2e-tests,
visual-regression-tests,
]
if: always()
steps:
- name: Evaluate results
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "One or more checks failed"
exit 1
fi
if [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more checks were cancelled"
exit 1
fi
echo "All checks passed or were skipped"