Repository navigation
spec(AST-017): touch behavior is a default callers can override with presentation #21788
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # PR CI: test, build, analyze, a11y audit, and comment | |
| # Everything runs in parallel where possible | |
| # | |
| # Merge queue: test + build also run on merge_group events so the | |
| # merge queue can gate on them before landing a PR. | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: ['main', 'release/**'] | |
| merge_group: | |
| # Explicit release checks and baseline capture share the canonical owners. | |
| # Reviewed captures are committed through a normal pull request. | |
| workflow_dispatch: | |
| inputs: | |
| operation: | |
| description: 'Run the canonical check on exact main or a marked release branch, or capture a main baseline candidate' | |
| type: choice | |
| options: [capture, release-check] | |
| default: capture | |
| required: true | |
| release-branch: | |
| description: 'Exact branch to check: main before a cut, or marked release/vX.Y.Z after the bump' | |
| type: string | |
| required: false | |
| release-version: | |
| description: 'Exact X.Y.Z version recorded by the active marker; required only for a marked release branch' | |
| type: string | |
| required: false | |
| expected-head: | |
| description: 'Exact full main or release branch SHA; required for release-check' | |
| type: string | |
| required: false | |
| plan-digest: | |
| description: 'Exact SHA-256 digest recorded by the active marker; required only for a marked release branch' | |
| type: string | |
| required: false | |
| permissions: {} | |
| concurrency: | |
| group: 'ci-${{ github.event.merge_group.head_sha || github.head_ref || github.run_id }}' | |
| cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }} | |
| jobs: | |
| maintenance-request: | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'capture' | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Require explicit main-branch maintenance | |
| run: | | |
| set -eu | |
| if [ "$GITHUB_REF" != 'refs/heads/main' ]; then | |
| echo 'Baseline maintenance must be dispatched from main.' | |
| exit 1 | |
| fi | |
| # Detect lightweight changes. Missing merge-base data fails closed. | |
| check-scope: | |
| if: github.event_name != 'workflow_dispatch' || inputs.operation == 'release-check' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| outputs: | |
| docsite_only: ${{ steps.scope.outputs.docsite_only }} | |
| spec_only: ${{ steps.scope.outputs.spec_only }} | |
| tooling_only: ${{ steps.scope.outputs.tooling_only }} | |
| release_bump: ${{ steps.scope.outputs.release_bump }} | |
| release_branch: ${{ steps.release-authority.outputs.branch || steps.main-authority.outputs.branch }} | |
| release_head: ${{ steps.release-authority.outputs.head || steps.main-authority.outputs.head }} | |
| release_plan_digest: ${{ steps.release-authority.outputs.planDigest }} | |
| steps: | |
| # Full history only where the release-branch validator reads it (tags, | |
| # the cut commit, release diffs). A PR's merge commit has the base tip | |
| # as a parent, and a main pre-cut check fetches current main on top, so | |
| # 50 commits are plenty there; the full clone took over a minute. | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.sha }} | |
| fetch-depth: ${{ ((github.event_name == 'workflow_dispatch' && inputs['release-branch'] != 'main') || (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release/v'))) && '0' || '50' }} | |
| - name: Fetch active release refs | |
| if: >- | |
| (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' && inputs['release-branch'] != 'main') || | |
| (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release/v')) | |
| run: git fetch origin '+refs/heads/release/v*:refs/remotes/origin/release/v*' | |
| - name: Validate active release authority | |
| id: release-authority | |
| if: >- | |
| (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' && inputs['release-branch'] != 'main') || | |
| (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release/v')) | |
| env: | |
| RELEASE_BRANCH: ${{ github.event_name == 'workflow_dispatch' && inputs['release-branch'] || github.base_ref }} | |
| RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs['release-version'] || '' }} | |
| EXPECTED_HEAD: ${{ github.event_name == 'workflow_dispatch' && inputs['expected-head'] || github.event.pull_request.head.sha }} | |
| PLAN_DIGEST: ${{ github.event_name == 'workflow_dispatch' && inputs['plan-digest'] || '' }} | |
| RECEIPT_HEAD: ${{ github.event_name == 'workflow_dispatch' && github.sha || github.event.pull_request.head.sha }} | |
| REF_NAME: ${{ github.event_name == 'workflow_dispatch' && github.ref_name || github.base_ref }} | |
| MODE: ${{ github.event_name == 'workflow_dispatch' && 'check' || 'pr' }} | |
| run: | | |
| set -eu | |
| TRUSTED_POLICY="$RUNNER_TEMP/release-policy" | |
| mkdir -p "$TRUSTED_POLICY/scripts/release" "$TRUSTED_POLICY/scripts/lib" | |
| git show "origin/$RELEASE_BRANCH:scripts/release/active-release.mjs" \ | |
| > "$TRUSTED_POLICY/scripts/release/active-release.mjs" | |
| git show "origin/$RELEASE_BRANCH:scripts/lib/workspace-globs.mjs" \ | |
| > "$TRUSTED_POLICY/scripts/lib/workspace-globs.mjs" | |
| VALIDATOR="$TRUSTED_POLICY/scripts/release/active-release.mjs" | |
| ACTIVE_BRANCHES=$(node "$VALIDATOR" list-active --root "$GITHUB_WORKSPACE") | |
| ARGS=( | |
| validate | |
| --root "$GITHUB_WORKSPACE" | |
| --mode "$MODE" | |
| --release-branch "$RELEASE_BRANCH" | |
| --expected-head "$EXPECTED_HEAD" | |
| --checkout-sha "$RECEIPT_HEAD" | |
| --ref-name "$REF_NAME" | |
| --active-branches "$ACTIVE_BRANCHES" | |
| ) | |
| if [ "$MODE" = check ]; then | |
| ARGS+=(--release-version "$RELEASE_VERSION" --plan-digest "$PLAN_DIGEST") | |
| REMOTE_HEAD=$(git ls-remote origin "refs/heads/$RELEASE_BRANCH" | awk '{print $1}') | |
| ARGS+=(--remote-head "$REMOTE_HEAD") | |
| fi | |
| node "$VALIDATOR" "${ARGS[@]}" | |
| - name: Validate exact main pre-cut authority | |
| id: main-authority | |
| if: >- | |
| github.event_name == 'workflow_dispatch' && | |
| inputs.operation == 'release-check' && | |
| inputs['release-branch'] == 'main' | |
| env: | |
| EXPECTED_HEAD: ${{ inputs['expected-head'] }} | |
| run: | | |
| set -eu | |
| if [ "$GITHUB_REF" != 'refs/heads/main' ]; then | |
| echo 'Main pre-cut checks must be dispatched from main.' | |
| exit 1 | |
| fi | |
| if ! [[ "$EXPECTED_HEAD" =~ ^[0-9a-f]{40}$ ]]; then | |
| echo 'Main pre-cut checks require an exact full expected head.' | |
| exit 1 | |
| fi | |
| if [ "$GITHUB_SHA" != "$EXPECTED_HEAD" ]; then | |
| echo 'Checked-out main commit does not match expected head.' | |
| exit 1 | |
| fi | |
| REMOTE_HEAD=$(git ls-remote origin refs/heads/main | awk '{print $1}') | |
| if [ -z "$REMOTE_HEAD" ]; then | |
| echo 'Current main head is unavailable.' | |
| exit 1 | |
| fi | |
| git fetch --no-tags origin "$REMOTE_HEAD" | |
| if ! git merge-base --is-ancestor "$EXPECTED_HEAD" "$REMOTE_HEAD"; then | |
| echo 'Checked main commit is not an ancestor of current main.' | |
| exit 1 | |
| fi | |
| printf 'branch=main\nhead=%s\n' "$EXPECTED_HEAD" >> "$GITHUB_OUTPUT" | |
| - name: Fetch base branch | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.base_ref }} --depth=50 | |
| - name: Determine change scope | |
| id: scope | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| BASE_REF: ${{ github.base_ref }} | |
| run: | | |
| if [ "$EVENT_NAME" != pull_request ]; then | |
| printf 'docsite_only=false\nspec_only=false\ntooling_only=false\nrelease_bump=false\n' >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if [[ "$BASE_REF" == release/v* ]]; then | |
| # Release bump PRs contain generated bookkeeping only. The final | |
| # branch head receives one full visual/a11y/RTL release-check. | |
| printf 'docsite_only=false\nspec_only=true\ntooling_only=true\nrelease_bump=true\n' >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }} 2>/dev/null || echo "") | |
| if [ -z "$MERGE_BASE" ]; then | |
| printf 'docsite_only=false\nspec_only=false\ntooling_only=false\nrelease_bump=false\n' >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo 'release_bump=false' >> "$GITHUB_OUTPUT" | |
| CLASSIFIER_ROOT="$RUNNER_TEMP/change-scope" | |
| CLASSIFIER_DIR="$CLASSIFIER_ROOT/.github/scripts" | |
| REGISTRY_DIR="$CLASSIFIER_ROOT/scripts" | |
| mkdir -p "$CLASSIFIER_DIR" "$REGISTRY_DIR" | |
| CLASSIFIER="$CLASSIFIER_DIR/change-scope.cjs" | |
| MATCHER="$CLASSIFIER_DIR/knowledge-paths.cjs" | |
| REGISTRY="$REGISTRY_DIR/component-packages.cjs" | |
| if git show "origin/${{ github.base_ref }}:.github/scripts/change-scope.cjs" > "$CLASSIFIER" 2>/dev/null \ | |
| && git show "origin/${{ github.base_ref }}:.github/scripts/knowledge-paths.cjs" > "$MATCHER" 2>/dev/null \ | |
| && git show "origin/${{ github.base_ref }}:scripts/component-packages.cjs" > "$REGISTRY" 2>/dev/null; then | |
| git diff --name-status "$MERGE_BASE"...HEAD \ | |
| | node "$CLASSIFIER" --github-output | |
| else | |
| # Missing trusted policy or dependencies cannot grant a specialized | |
| # lane. Run broad CI until the base branch supplies the full classifier. | |
| printf 'docsite_only=false\nspec_only=false\ntooling_only=false\n' \ | |
| >> "$GITHUB_OUTPUT" | |
| fi | |
| # Generated-only version PR lane. It validates release bookkeeping in a few | |
| # minutes; the merged branch head receives one full visual/a11y/RTL projection. | |
| release-bump: | |
| needs: [check-scope] | |
| if: ${{ github.event_name == 'pull_request' && needs.check-scope.outputs.release_bump == 'true' }} | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 0 | |
| - name: Fetch release refs, base, and trusted release policy | |
| run: | | |
| git fetch origin '+refs/heads/release/v*:refs/remotes/origin/release/v*' | |
| git fetch origin "${{ github.base_ref }}" --depth=50 | |
| TRUSTED_POLICY="$RUNNER_TEMP/release-policy" | |
| mkdir -p "$TRUSTED_POLICY/scripts/release" "$TRUSTED_POLICY/scripts/lib" | |
| git show "origin/${{ github.base_ref }}:scripts/release/active-release.mjs" \ | |
| > "$TRUSTED_POLICY/scripts/release/active-release.mjs" | |
| git show "origin/${{ github.base_ref }}:scripts/lib/workspace-globs.mjs" \ | |
| > "$TRUSTED_POLICY/scripts/lib/workspace-globs.mjs" | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| - name: Require generated-only release bookkeeping | |
| run: | | |
| node "$RUNNER_TEMP/release-policy/scripts/release/active-release.mjs" validate-diff \ | |
| --root "$GITHUB_WORKSPACE" \ | |
| --base "origin/${{ github.base_ref }}" \ | |
| --head "${{ github.event.pull_request.head.sha }}" | |
| - name: Validate branch, head, plan, versions, and Changeset consumption | |
| run: | | |
| set -eu | |
| VALIDATOR="$RUNNER_TEMP/release-policy/scripts/release/active-release.mjs" | |
| ACTIVE_BRANCHES=$(node "$VALIDATOR" list-active --root "$GITHUB_WORKSPACE") | |
| node "$VALIDATOR" validate \ | |
| --root "$GITHUB_WORKSPACE" \ | |
| --mode pr \ | |
| --release-branch "${{ github.base_ref }}" \ | |
| --expected-head "${{ github.event.pull_request.head.sha }}" \ | |
| --checkout-sha "${{ github.event.pull_request.head.sha }}" \ | |
| --ref-name "${{ github.base_ref }}" \ | |
| --active-branches "$ACTIVE_BRANCHES" \ | |
| | tee release-bump-receipt.json | |
| - name: Validate generated changelogs and codemods | |
| run: | | |
| pnpm check:changesets | |
| node scripts/format-changelogs.mjs --check | |
| VERSION=$(node -p "require('./.release/active.json').version") | |
| pnpm exec vitest run \ | |
| "packages/cli/assets/codemods/transforms/v${VERSION}/__tests__" \ | |
| packages/cli/assets/codemods/__tests__/registry.test.mjs | |
| - name: Upload exact-head release bump receipt | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-bump-receipt-${{ github.event.pull_request.head.sha }} | |
| path: release-bump-receipt.json | |
| retention-days: 30 | |
| release-merge-back: | |
| name: release-merge-back | |
| if: ${{ github.event_name == 'pull_request' && github.base_ref == 'main' }} | |
| # Match the stable publisher so byte parity covers the same packed manifest. | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout merge-back candidate | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect the release-merge-back branch contract | |
| id: release-merge-back-scope | |
| env: | |
| MERGE_BRANCH: ${{ github.head_ref }} | |
| run: | | |
| set -eu | |
| case "$MERGE_BRANCH" in | |
| chore/merge-v*-to-main) | |
| VERSION=${MERGE_BRANCH#chore/merge-v} | |
| VERSION=${VERSION%-to-main} | |
| printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' | |
| echo 'required=true' >> "$GITHUB_OUTPUT" | |
| ;; | |
| *) | |
| echo 'required=false' >> "$GITHUB_OUTPUT" | |
| ;; | |
| esac | |
| - name: Fetch release authority and trusted validator | |
| if: steps.release-merge-back-scope.outputs.required == 'true' | |
| run: | | |
| set -eu | |
| git fetch origin main 'refs/tags/v*:refs/tags/v*' '+refs/heads/release/v*:refs/remotes/origin/release/v*' | |
| TRUSTED_POLICY="$RUNNER_TEMP/release-policy" | |
| mkdir -p "$TRUSTED_POLICY/scripts/release" "$TRUSTED_POLICY/scripts/lib" | |
| git show origin/main:scripts/release/active-release.mjs \ | |
| > "$TRUSTED_POLICY/scripts/release/active-release.mjs" | |
| git show origin/main:scripts/lib/workspace-globs.mjs \ | |
| > "$TRUSTED_POLICY/scripts/lib/workspace-globs.mjs" | |
| - name: Validate published bytes and consumed-only Changeset merge-back | |
| if: steps.release-merge-back-scope.outputs.required == 'true' | |
| env: | |
| MERGE_BRANCH: ${{ github.head_ref }} | |
| run: | | |
| set -eu | |
| VERSION=${MERGE_BRANCH#chore/merge-v} | |
| VERSION=${VERSION%-to-main} | |
| printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' | |
| VALIDATOR="$RUNNER_TEMP/release-policy/scripts/release/active-release.mjs" | |
| ACTIVE_BRANCHES=$(node "$VALIDATOR" list-active --root "$GITHUB_WORKSPACE") | |
| node "$VALIDATOR" validate-merge-back \ | |
| --root "$GITHUB_WORKSPACE" \ | |
| --base origin/main \ | |
| --release-ref "v$VERSION" \ | |
| --active-branches "$ACTIVE_BRANCHES" | |
| - name: Setup Node and pnpm for published-byte verification | |
| if: steps.release-merge-back-scope.outputs.required == 'true' | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Verify immutable tag package bytes match npm | |
| if: steps.release-merge-back-scope.outputs.required == 'true' | |
| env: | |
| MERGE_BRANCH: ${{ github.head_ref }} | |
| run: | | |
| set -eu | |
| VERSION=${MERGE_BRANCH#chore/merge-v} | |
| VERSION=${VERSION%-to-main} | |
| TAG_ROOT="$RUNNER_TEMP/release-tag" | |
| git worktree add --detach "$TAG_ROOT" "v$VERSION" | |
| cd "$TAG_ROOT" | |
| pnpm install --frozen-lockfile | |
| pnpm build | |
| node scripts/release/verify-published.mjs --version "$VERSION" | |
| # Required docsite owner: data tests plus the production browser contract. | |
| # Historical required check name (AST-030 FR7). It joins the two docsite | |
| # owners, which run side by side: the browser contract (~10 minutes) used to | |
| # be followed by this job's own generation and tests (~2.5 minutes). The | |
| # spec-only lane validates spec records here, where it always has. | |
| docsite-test: | |
| needs: [check-scope, docsite-browser, docsite-data] | |
| if: ${{ github.event_name != 'workflow_dispatch' && needs.check-scope.outputs.release_bump != 'true' && always() && !cancelled() }} | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - name: Require successful docsite browser contract | |
| if: needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| env: | |
| DOCSITE_BROWSER_RESULT: ${{ needs.docsite-browser.result }} | |
| run: test "$DOCSITE_BROWSER_RESULT" = 'success' | |
| - name: Require successful docsite data generation and tests | |
| if: needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| env: | |
| DOCSITE_DATA_RESULT: ${{ needs.docsite-data.result }} | |
| run: test "$DOCSITE_DATA_RESULT" = 'success' | |
| - name: Skip docsite work for Node tooling | |
| if: needs.check-scope.outputs.tooling_only == 'true' | |
| run: echo "Node-tooling PR — docsite generation is not an owned check" | |
| - uses: actions/checkout@v7 | |
| if: needs.check-scope.outputs.spec_only == 'true' | |
| # Spec validation imports the canonical CLI discovery path, so the | |
| # lightweight docs path needs workspace dependencies too. | |
| - uses: ./.github/actions/setup | |
| if: needs.check-scope.outputs.spec_only == 'true' | |
| - name: Validate spec records | |
| if: needs.check-scope.outputs.spec_only == 'true' | |
| run: node scripts/check-knowledge.mjs | |
| # Docsite data generation and tests. Its outcome feeds docsite-test. | |
| docsite-data: | |
| needs: [check-scope] | |
| if: github.event_name != 'workflow_dispatch' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/setup | |
| # Docsite `generate` runs `astryx theme build`, which imports the compiled | |
| # @astryxdesign/core/theme entry (dist/theme/index.js). Build core first so that | |
| # entry exists — otherwise generate fails with "Cannot find module". | |
| - name: Build core package | |
| if: needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/core build | |
| # The generated preview registry imports every configured canary component | |
| # package. Build those exports so Vitest exercises the same graph as the | |
| # canary deployment. | |
| - name: Build canary component packages | |
| if: needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: | | |
| pnpm -F @astryxdesign/lab build | |
| pnpm -F @astryxdesign/charts build | |
| pnpm -F @astryxdesign/richtext build | |
| pnpm -F @astryxdesign/vega build | |
| - name: Generate and test docsite data | |
| if: needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/docsite generate && pnpm -F @astryxdesign/docsite test | |
| # Docsite browser contracts. The playground preview runs user-authored code | |
| # in a sandboxed iframe whose only tie to the page is a nonce-attested | |
| # MessagePort handshake (apps/docsite/src/app/playground/previewChannel.ts). | |
| # jsdom can drive that state machine but cannot prove the integration: that | |
| # the frame's real `load` event reaches it, that a replaced document is torn | |
| # down and the current code and theme reach its successor, and that a | |
| # document previewed code navigated the frame to receives nothing. Only the | |
| # production build has the opaque-origin sandbox at all, so this job builds | |
| # the docsite and drives `next start` in Chromium. Its outcome feeds the | |
| # existing required docsite-test context; it is not another required lane. | |
| docsite-browser: | |
| needs: [check-scope] | |
| if: github.event_name != 'workflow_dispatch' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| # The longest docsite owner; the Next.js production build uses every core | |
| # it gets. | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/setup | |
| - name: Install Playwright | |
| run: npx playwright install chromium | |
| # The production build imports every theme package's built entry and the | |
| # canary component packages, on top of core. Core builds first; the rest | |
| # depend on it and not on each other, so they build side by side. | |
| - name: Build docsite workspace dependencies | |
| run: | | |
| pnpm -F @astryxdesign/core build | |
| pnpm --workspace-concurrency=4 \ | |
| -F @astryxdesign/lab \ | |
| -F @astryxdesign/charts \ | |
| -F @astryxdesign/richtext \ | |
| -F @astryxdesign/vega \ | |
| -F @astryxdesign/theme-neutral \ | |
| -F @astryxdesign/theme-matcha \ | |
| -F @astryxdesign/theme-stone \ | |
| -F @astryxdesign/theme-gothic \ | |
| -F @astryxdesign/theme-chocolate \ | |
| -F @astryxdesign/theme-y2k \ | |
| -F @astryxdesign/theme-butter \ | |
| build | |
| - name: Build the docsite | |
| run: pnpm -F @astryxdesign/docsite build | |
| - name: Run docsite browser contracts | |
| run: pnpm test:docsite-browser | |
| - name: Upload docsite browser evidence | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: docsite-browser-evidence | |
| path: test-results/docsite/ | |
| if-no-files-found: error | |
| retention-days: 7 | |
| # Lightweight check — does the PR touch any published components? | |
| # Gates pr-a11y and pr-rtl to avoid unnecessary work. | |
| # | |
| # `scripts/component-packages.cjs` owns the component source roots used here | |
| # and by the RTL roster. `analyze-pr.js` still decides which changed components | |
| # each downstream audit receives. When those projections disagree the audits | |
| # silently no-op, so harness/registry changes also exercise the RTL smoke scope. | |
| # Spec-only changes keep only the trusted scope classifier and the | |
| # knowledge validator below. Unrelated component discovery must not take a | |
| # runner or fan out into visual, accessibility, or RTL work. | |
| check-components: | |
| needs: [check-scope] | |
| if: (github.event_name == 'pull_request' && needs.check-scope.outputs.spec_only != 'true') || (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check') | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| outputs: | |
| has_components: ${{ steps.check.outputs.has_components }} | |
| has_rtl_components: ${{ steps.check.outputs.has_rtl_components }} | |
| has_rtl_harness: ${{ steps.check.outputs.has_rtl_harness }} | |
| force_full_component_audits: ${{ steps.check.outputs.force_full_component_audits }} | |
| # Stable visual scope is separate from component scope: Core and the | |
| # non-private shipped themes participate; canaryOnly packages do not. | |
| has_stable_visual: ${{ steps.check.outputs.has_stable_visual }} | |
| broad_stable_visual: ${{ steps.check.outputs.broad_stable_visual }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| # Depth 50 (same as check-scope) so the three-dot diff below can find | |
| # a merge base. With the default depth of 1 the diff fails with | |
| # "no merge base", the error is swallowed by the pipeline, and | |
| # has_components silently becomes false — skipping pr-a11y entirely. | |
| fetch-depth: 50 | |
| - name: Fetch base branch | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.base_ref }} --depth=50 | |
| - name: Check for component changes | |
| id: check | |
| run: | | |
| if [ "${{ github.event_name }}" = 'workflow_dispatch' ]; then | |
| printf 'has_components=true\nhas_rtl_components=true\nhas_rtl_harness=true\nforce_full_component_audits=true\nhas_stable_visual=true\nbroad_stable_visual=true\n' >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if [ "${{ needs.check-scope.outputs.docsite_only }}" = "true" ] \ | |
| || [ "${{ needs.check-scope.outputs.spec_only }}" = "true" ] \ | |
| || [ "${{ needs.check-scope.outputs.tooling_only }}" = "true" ]; then | |
| printf 'has_components=false\nhas_rtl_components=false\nhas_rtl_harness=false\nforce_full_component_audits=false\nhas_stable_visual=false\n' >> "$GITHUB_OUTPUT" | |
| echo "Trusted specialized lane — component audits explicitly not applicable." | |
| exit 0 | |
| fi | |
| if ! MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }} 2>/dev/null); then | |
| echo "::warning::No merge base between HEAD and origin/${{ github.base_ref }} — running full component audits" | |
| printf 'has_components=true\nhas_rtl_components=true\nhas_rtl_harness=true\nforce_full_component_audits=true\n' >> "$GITHUB_OUTPUT" | |
| echo "has_stable_visual=true" >> "$GITHUB_OUTPUT" | |
| echo "broad_stable_visual=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| POLICY_ROOT="$RUNNER_TEMP/component-audit-scope" | |
| mkdir -p "$POLICY_ROOT/.github/scripts" "$POLICY_ROOT/scripts" | |
| SCOPE="$POLICY_ROOT/.github/scripts/component-audit-scope.cjs" | |
| REGISTRY="$POLICY_ROOT/scripts/component-packages.cjs" | |
| if git show "origin/${{ github.base_ref }}:.github/scripts/component-audit-scope.cjs" > "$SCOPE" 2>/dev/null \ | |
| && git show "origin/${{ github.base_ref }}:scripts/component-packages.cjs" > "$REGISTRY" 2>/dev/null; then | |
| git diff --name-status "$MERGE_BASE"...HEAD \ | |
| | node "$SCOPE" --registry "$REGISTRY" --github-output | |
| else | |
| echo "::warning::Trusted component audit policy is unavailable — running full component audits" | |
| printf 'has_components=true\nhas_rtl_components=true\nhas_rtl_harness=true\nforce_full_component_audits=true\n' >> "$GITHUB_OUTPUT" | |
| fi | |
| FILES=$(git diff --name-only "$MERGE_BASE"...HEAD) | |
| # One classifier owns the release-channel rule. It reads each | |
| # package's `astryx.canaryOnly` metadata rather than hard-coding | |
| # today's Lab/charts/richtext/vega list. | |
| printf '%s\n' "$FILES" \ | |
| | node .github/scripts/visual-scope.mjs --github-output "$GITHUB_OUTPUT" | |
| # Tests run as two parallel lanes joined by `test` below. | |
| # | |
| # They used to be one `pnpm test` on a 2-core runner, which ran both Vitest | |
| # projects back to back and was terminated around 20 minutes with no summary | |
| # — no assertion output, so nothing said which suite was at fault. `main` was | |
| # already at ~19m15, so the budget, not any one test, was the defect. | |
| # | |
| # The projects are independent by construction (see vitest.config.ts: `ui` is | |
| # jsdom + StyleX, `node` is everything else), so running them as two jobs | |
| # costs no duplicate execution. They do NOT carry half the work each: on this | |
| # CI, `ui` is ~5x the heavier lane, so it takes the larger runner. | |
| # | |
| # The earlier local figure that put `node` ahead (570s vs 244s) was not a | |
| # comparable measurement — only the node run was bounded to a small worker | |
| # pool, and node is the project whose cost is per-assertion CLI subprocesses. | |
| # | |
| # The repo-wide guardrail steps ride `test-ui` (~18s of it). | |
| # | |
| # `test` remains a job, so the required check of that name still exists and | |
| # still reports for every PR. This mirrors the `build` join over | |
| # build-storybook + build-sandbox below. | |
| test-ui: | |
| name: test-ui (${{ matrix.shard }}/${{ strategy.job-total }}) | |
| needs: [check-scope] | |
| if: ${{ github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| # One runner ran the whole UI project in ~16 minutes and set the PR's wall | |
| # time. Vitest's --shard gives each leg an equal share of the files; the | |
| # two slowest files (~3.5 minutes each) bound a leg, so more legs stop | |
| # paying. `test` joins the legs: the job result is success only when | |
| # every leg passed. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - name: Skip heavy work for a specialized lane | |
| if: needs.check-scope.outputs.docsite_only == 'true' || needs.check-scope.outputs.spec_only == 'true' || needs.check-scope.outputs.tooling_only == 'true' | |
| run: echo "Specialized PR lane — skipping unrelated test suite" | |
| - uses: actions/checkout@v7 | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| - uses: ./.github/actions/setup | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| - name: Check knowledge schema history | |
| if: >- | |
| matrix.shard == 1 && | |
| github.event_name == 'pull_request' && | |
| needs.check-scope.outputs.docsite_only != 'true' && | |
| needs.check-scope.outputs.spec_only != 'true' && | |
| needs.check-scope.outputs.tooling_only != 'true' | |
| run: | | |
| git fetch origin "${{ github.event.pull_request.base.sha }}" --depth=1 | |
| node scripts/check-knowledge.mjs --base "${{ github.event.pull_request.base.sha }}" | |
| - name: Check copyright headers | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: ./scripts/add-copyright.sh --check | |
| - name: Check package.json exports are in sync | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: node scripts/sync-exports.js --check | |
| - name: Verify the published CLI ./api type surface | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: node .github/scripts/cli-api-types-verify.mjs | |
| - name: Check token docs are in sync | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: node scripts/generate-token-docs.mjs --check | |
| # Fails when the lab readiness manifest claims a check the source tree | |
| # contradicts — the report is derived, never hand-maintained. | |
| - name: Check lab readiness manifest is current | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm lab:readiness:check | |
| - name: Run this shard of the UI tests | |
| run: pnpm vitest run --project ui --exclude packages/core/src/Markdown/Markdown.fr23.perf.test.ts --shard=${{ matrix.shard }}/${{ strategy.job-total }} | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| # A child process isolates engine state, not CPU or memory contention. | |
| # FR23 must wait until this runner's other UI workers have exited | |
| # (AST-036); the other shards run on other machines. | |
| - name: Run the isolated Markdown benchmark | |
| run: pnpm vitest run --project ui packages/core/src/Markdown/Markdown.fr23.perf.test.ts --no-file-parallelism | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| test-node: | |
| name: test-node (${{ matrix.shard }}/${{ strategy.job-total }}) | |
| needs: [check-scope] | |
| if: ${{ github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| # One runner ran the Node project in ~12 minutes. Vitest's --shard splits | |
| # the files across the legs; `test` joins them. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| # Vitest runs one test file per CPU beyond the first, so the 2-core runner | |
| # ran this suite one file at a time (~23 min). Four cores give it three. | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - name: Skip heavy work for a specialized lane | |
| if: needs.check-scope.outputs.docsite_only == 'true' || needs.check-scope.outputs.spec_only == 'true' | |
| run: echo "Specialized PR lane — skipping unrelated test suite" | |
| - uses: actions/checkout@v7 | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' | |
| - uses: ./.github/actions/setup | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' | |
| - run: pnpm vitest run --project node --shard=${{ matrix.shard }}/${{ strategy.job-total }} | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' | |
| # Theme-family compilation is owned by `theme-build`, not Build. Until | |
| # that surface has an admitted dedicated lane, broad CI keeps its browser | |
| # contract inside the existing Node test owner rather than `test-build`. | |
| # One leg runs it. | |
| - name: Install Playwright for theme-family contract | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: npx playwright install chromium | |
| - name: Build theme-family compiler dependencies | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/core build | |
| - name: Generate the maintained theme-family fixture | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/sandbox generate:theme-family | |
| - name: Run theme family cascade guard | |
| if: matrix.shard == 1 && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: node .github/scripts/theme-family-cascade.js | |
| # Native Swift: the Swift packages of the experimental, canary-only | |
| # @astryxdesign/native (AST-082) build and test only on macOS. They are | |
| # coverage inside the shared surface (AST-030 FR11), so `test` joins | |
| # test-native-swift. A Linux job first decides whether the change touches | |
| # Swift under packages/native or the lane's own script; only then does | |
| # test-native-swift take a macOS runner, and otherwise it passes on Linux | |
| # without work. | |
| native-swift-scope: | |
| needs: [check-scope] | |
| if: ${{ github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| outputs: | |
| applies: ${{ steps.scope.outputs.applies }} | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - uses: actions/checkout@v7 | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| # The helper comes from the base, since an older head lacks it. Exit 1 | |
| # means out of scope; 0 in scope; 2 unknown, so the Swift work runs. | |
| - name: Decide whether native Swift changed | |
| id: scope | |
| env: | |
| DOCSITE_ONLY: ${{ needs.check-scope.outputs.docsite_only }} | |
| TOOLING_ONLY: ${{ needs.check-scope.outputs.tooling_only }} | |
| BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} | |
| run: | | |
| if [ "$DOCSITE_ONLY" = true ] || [ "$TOOLING_ONLY" = true ]; then | |
| echo 'Specialized lane; no native Swift work.' | |
| echo 'applies=false' >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| scope=2 | |
| helper="$(mktemp)" | |
| if [ -n "$BASE_SHA" ] \ | |
| && git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" '^packages/native/.*(\.swift|/Package\.swift)$|^\.github/scripts/native-swift\.sh$' || scope=$? | |
| fi | |
| if [ "$scope" = 1 ]; then | |
| echo 'No native Swift change; nothing to build.' | |
| echo 'applies=false' >> "$GITHUB_OUTPUT" | |
| else | |
| echo 'applies=true' >> "$GITHUB_OUTPUT" | |
| fi | |
| test-native-swift: | |
| needs: [check-scope, native-swift-scope] | |
| if: ${{ github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| runs-on: ${{ needs.native-swift-scope.outputs.applies == 'true' && 'macos-15' || 'ubuntu-slim' }} | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require a decided Swift scope | |
| if: needs.native-swift-scope.result != 'success' | |
| run: | | |
| echo "Native Swift scope could not be decided; refusing to skip required work." | |
| exit 1 | |
| - name: Skip Swift work outside its scope | |
| if: needs.native-swift-scope.outputs.applies != 'true' | |
| run: echo "No native Swift change in this scope." | |
| - uses: actions/checkout@v7 | |
| if: needs.native-swift-scope.outputs.applies == 'true' | |
| # The steps live in native-swift.sh, which is in the native Swift scope, | |
| # so a change to them runs on its own pull request. | |
| - name: Build and test each native Swift package | |
| if: needs.native-swift-scope.outputs.applies == 'true' | |
| run: bash .github/scripts/native-swift.sh | |
| # Public registry contract. Generation proves schema, dependency, route-lock, | |
| # alias, and release-gating invariants; the final step drives every canonical | |
| # item through the exact pinned ShadCN client and compiles every written source. | |
| registry-contract: | |
| name: registry-contract (${{ matrix.leg }}) | |
| needs: [check-scope] | |
| if: ${{ github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| # The preview and hidden production registries are generated and verified | |
| # independently, so each gets its own leg (~9 minutes in one job). `test` | |
| # joins them: the job result is success only when both passed. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| leg: [preview, production] | |
| runs-on: 4-core-ubuntu | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - name: Skip registry work for spec-only changes | |
| if: needs.check-scope.outputs.spec_only == 'true' | |
| run: echo "Spec-only PR — public registry output cannot change" | |
| - uses: actions/checkout@v7 | |
| if: needs.check-scope.outputs.spec_only != 'true' | |
| - uses: ./.github/actions/setup | |
| if: needs.check-scope.outputs.spec_only != 'true' | |
| - name: Build registry package exports | |
| if: needs.check-scope.outputs.spec_only != 'true' | |
| run: pnpm build | |
| - name: Verify hidden production registry contract | |
| if: matrix.leg == 'production' && needs.check-scope.outputs.spec_only != 'true' | |
| run: node internal/shadcn-registry/verify-production-gate.mjs | |
| - name: Generate and validate the complete preview registry | |
| if: matrix.leg == 'preview' && needs.check-scope.outputs.spec_only != 'true' | |
| env: | |
| DOCSITE_TARGET: canary | |
| run: node apps/docsite/scripts/generate-data.mjs | |
| - name: Install and build every preview registry item | |
| if: matrix.leg == 'preview' && needs.check-scope.outputs.spec_only != 'true' | |
| run: node internal/shadcn-registry/verify-full-catalog.mjs | |
| - name: Generate the hidden production registry | |
| if: matrix.leg == 'production' && needs.check-scope.outputs.spec_only != 'true' | |
| env: | |
| DOCSITE_TARGET: latest | |
| run: node apps/docsite/scripts/generate-data.mjs | |
| - name: Verify hidden production discovery surfaces | |
| if: matrix.leg == 'production' && needs.check-scope.outputs.spec_only != 'true' | |
| env: | |
| ASTRYX_VERIFY_HIDDEN_PRODUCTION: '1' | |
| NEXT_PUBLIC_DOCS_TARGET: latest | |
| run: pnpm -F @astryxdesign/docsite exec vitest run src/__tests__/hidden-shadcn-production.test.ts | |
| - name: Install and build every hidden production registry item | |
| if: matrix.leg == 'production' && needs.check-scope.outputs.spec_only != 'true' | |
| env: | |
| ASTRYX_SHADCN_USE_PUBLISHED_PACKAGES: '1' | |
| run: node internal/shadcn-registry/verify-full-catalog.mjs | |
| # Historical required check name. The Vitest lanes, Build test owner, and | |
| # public registry contract always report or explicitly skip, so this join | |
| # projects their combined result without creating another surface lane. | |
| test: | |
| needs: | |
| [ | |
| check-scope, | |
| test-ui, | |
| test-node, | |
| test-build, | |
| registry-contract, | |
| test-native-swift, | |
| ] | |
| if: ${{ github.event_name != 'workflow_dispatch' && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Require expected test-owner outcomes | |
| env: | |
| CHECK_SCOPE_RESULT: ${{ needs.check-scope.result }} | |
| DOCSITE_ONLY: ${{ needs.check-scope.outputs.docsite_only }} | |
| SPEC_ONLY: ${{ needs.check-scope.outputs.spec_only }} | |
| TOOLING_ONLY: ${{ needs.check-scope.outputs.tooling_only }} | |
| TEST_UI_RESULT: ${{ needs.test-ui.result }} | |
| TEST_NODE_RESULT: ${{ needs.test-node.result }} | |
| TEST_BUILD_RESULT: ${{ needs.test-build.result }} | |
| REGISTRY_CONTRACT_RESULT: ${{ needs.registry-contract.result }} | |
| TEST_NATIVE_SWIFT_RESULT: ${{ needs.test-native-swift.result }} | |
| run: node .github/scripts/ci-test-join.mjs | |
| # Build storybook + typecheck + analyze components (parallel with test and | |
| # build-sandbox). Uploads the storybook preview and analysis artifacts for | |
| # downstream jobs. | |
| # The sandbox preview build lives in build-sandbox: it alone takes ~4min | |
| # while everything here takes ~2min, so the two run in parallel and the | |
| # `build` join below folds their results into the historical check name. | |
| build-storybook: | |
| needs: [check-scope] | |
| if: ${{ (github.event_name != 'workflow_dispatch' || inputs.operation == 'release-check') && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| # Every browser lane waits for this job, and the package builds and the | |
| # Storybook build run side by side (build-packages-and-storybook.mjs). | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| outputs: | |
| short_hash: ${{ steps.release.outputs.short_hash || steps.urls.outputs.short_hash }} | |
| sandbox_url: ${{ steps.urls.outputs.sandbox_url }} | |
| pr_number: ${{ steps.urls.outputs.pr_number }} | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - name: Skip heavy work for a specialized lane | |
| if: needs.check-scope.outputs.docsite_only == 'true' || needs.check-scope.outputs.spec_only == 'true' || needs.check-scope.outputs.tooling_only == 'true' | |
| run: echo "Specialized PR lane — skipping unrelated build" | |
| - name: Checkout | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| uses: actions/checkout@v7 | |
| with: | |
| # Component evidence artifacts are named for and reviewed at the PR | |
| # head, so build their Storybook bytes from that exact tree rather | |
| # than GitHub's synthetic merge checkout. | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| # Depth 50 (same as check-scope) so analyze-pr.js's three-dot diff | |
| # can find a merge base — depth 1 breaks it ("no merge base") and | |
| # the analysis silently reported zero changed components. | |
| fetch-depth: 50 | |
| - name: Verify Storybook source checkout | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && github.event_name == 'pull_request' | |
| env: | |
| EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD_SHA" | |
| - name: Fetch base branch for PR analysis | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.base_ref }} --depth=50 | |
| - name: Setup Node and pnpm | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| uses: ./.github/actions/setup | |
| # The same steps as `pnpm build` and the Storybook build, overlapped: a | |
| # package builds once its workspace dependencies have, and Storybook once | |
| # the packages its story index records are built. | |
| - name: Build packages and Storybook | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: node .github/scripts/build-packages-and-storybook.mjs | |
| - name: Verify package exports | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: node scripts/verify-exports.mjs | |
| - name: Stamp Storybook source revision | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: git rev-parse HEAD > apps/storybook/dist/astryx-build-sha.txt | |
| - name: Compute PR preview path | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && github.event_name == 'pull_request' | |
| id: urls | |
| run: | | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| COMMIT_HASH="${{ github.event.pull_request.head.sha }}" | |
| SHORT_HASH="${COMMIT_HASH:0:7}" | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| REPO_OWNER="${{ github.repository_owner }}" | |
| echo "short_hash=${SHORT_HASH}" >> $GITHUB_OUTPUT | |
| echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT | |
| echo "sandbox_url=https://${REPO_OWNER}.github.io/${REPO_NAME}/pr/${PR_NUMBER}/sandbox/" >> $GITHUB_OUTPUT | |
| - name: Identify full release audit scope | |
| if: github.event_name == 'workflow_dispatch' && needs.check-scope.outputs.tooling_only != 'true' | |
| id: release | |
| run: | | |
| test "$(git rev-parse HEAD)" = "$GITHUB_SHA" | |
| echo "short_hash=${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT" | |
| printf '{"forceFullComponentAudits":true}\n' > analysis.json | |
| - name: Upload Storybook artifact | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && (github.event_name == 'pull_request' || inputs.operation == 'release-check') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: storybook-${{ steps.release.outputs.short_hash || steps.urls.outputs.short_hash }} | |
| path: apps/storybook/dist/ | |
| retention-days: 30 | |
| # pr-visual reads each theme's built source to learn which targets that | |
| # theme styles — a theme's component map is what defineTheme returns, not | |
| # a literal in its source. This job has already built them; shipping the | |
| # artifact keeps that job on a download instead of a second full build. | |
| # | |
| # core's dist ships with them because importing a built theme executes | |
| # `import {defineTheme} from '@astryxdesign/core/theme'`, which pnpm | |
| # resolves through the workspace link into packages/core/dist. | |
| # | |
| # Two paths, so the artifact is rooted at their common ancestor | |
| # (packages/) — the download below unpacks it there. | |
| - name: Upload built themes and core | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && (github.event_name == 'pull_request' || inputs.operation == 'release-check') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dists-${{ steps.release.outputs.short_hash || steps.urls.outputs.short_hash }} | |
| path: | | |
| packages/themes/*/dist/ | |
| packages/core/dist/ | |
| retention-days: 1 | |
| - name: Analyze components | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && github.event_name == 'pull_request' | |
| run: | | |
| node .github/scripts/analyze-pr.js \ | |
| --base origin/${{ github.base_ref }} \ | |
| --head HEAD \ | |
| --output analysis.json | |
| - name: Write PR comment metadata | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && github.event_name == 'pull_request' | |
| run: | | |
| # PR Comment reads this exact-run analysis. Storybook preview links | |
| # come from the exact-head Vercel deployment; the Sandbox artifact | |
| # remains on Pages until its separate migration. | |
| cat > pr-meta.json <<EOF | |
| { | |
| "prNumber": "${{ steps.urls.outputs.pr_number }}", | |
| "shortHash": "${{ steps.urls.outputs.short_hash }}", | |
| "headSha": "${{ github.event.pull_request.head.sha }}", | |
| "headRepository": "${{ github.event.pull_request.head.repo.full_name }}", | |
| "baseRepository": "${{ github.event.pull_request.base.repo.full_name }}", | |
| "runId": "${{ github.run_id }}", | |
| "runAttempt": "${{ github.run_attempt }}", | |
| "runUrl": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| } | |
| EOF | |
| - name: Upload analysis artifact | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' && (github.event_name == 'pull_request' || inputs.operation == 'release-check') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pr-analysis | |
| path: | | |
| analysis.json | |
| pr-meta.json | |
| retention-days: 1 | |
| # Typechecks run beside build-storybook instead of before its Storybook | |
| # build, so the browser checks that wait on the Storybook artifact start | |
| # ~1.5 minutes sooner. The build and release-check joins require this job, | |
| # so a type error still fails both. | |
| typecheck: | |
| needs: [check-scope] | |
| if: ${{ (github.event_name != 'workflow_dispatch' || inputs.operation == 'release-check') && always() && !cancelled() && needs.check-scope.outputs.spec_only != 'true' }} | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require successful scope classification | |
| if: needs.check-scope.result != 'success' | |
| run: | | |
| echo "Change scope could not be classified; refusing to skip required work." | |
| exit 1 | |
| - name: Skip typechecks for a specialized lane | |
| if: needs.check-scope.outputs.docsite_only == 'true' || needs.check-scope.outputs.spec_only == 'true' || needs.check-scope.outputs.tooling_only == 'true' | |
| run: echo "Specialized PR lane — skipping typechecks" | |
| - name: Checkout | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node and pnpm | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| uses: ./.github/actions/setup | |
| # The doc, template and CLI typechecks resolve the built package types. | |
| - name: Build packages | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm build | |
| - name: Typecheck component docs | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/core typecheck:docs | |
| - name: Typecheck lab docs | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/lab typecheck:docs | |
| - name: Typecheck charts docs | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/charts typecheck:docs | |
| - name: Typecheck rich text docs | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/richtext typecheck:docs | |
| - name: Typecheck Vega docs | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/vega typecheck:docs | |
| - name: Typecheck template docs | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/cli typecheck:template-docs | |
| # Full-package strict checkJs over the CLI (src, bin, scripts, docs, and | |
| # the emitted templates). Requires the `pnpm build` above so the template | |
| # .tsx sources can resolve the built @astryxdesign/{core,charts,lab} types. | |
| - name: Typecheck CLI (strict) | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/cli typecheck:strict | |
| - name: Typecheck storybook | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/storybook typecheck | |
| - name: Typecheck core (including tests) | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/core typecheck | |
| # The accessibility spec-test contracts are consumed as TypeScript source | |
| # by Vitest and Playwright, and neither runner typechecks. This is the | |
| # only gate over them. | |
| - name: Typecheck accessibility spec-test contracts | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/a11y-spec typecheck | |
| # The canary-only @astryxdesign/native is outside the root build, and | |
| # Vitest neither typechecks its source nor loads every platform's types. | |
| # Its build emits one declaration file per type-resolution condition | |
| # (ios, android, macos, windows, shared); the last step checks them all. | |
| - name: Typecheck native | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/native typecheck | |
| - name: Build native platform types | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/native build | |
| - name: Typecheck native platform types | |
| if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| run: pnpm -F @astryxdesign/native typecheck:types | |
| # Sandbox preview build — the single slowest piece of PR CI (~4min), run as | |
| # its own job so it overlaps build-storybook instead of serializing after it. | |
| # PR-only: merge_group runs never deploy previews, and docsite-only PRs skip | |
| # preview builds entirely. | |
| build-sandbox: | |
| needs: [check-scope] | |
| if: github.event_name == 'pull_request' && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| outputs: | |
| short_hash: ${{ steps.urls.outputs.short_hash }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| - name: Build core package | |
| run: pnpm build | |
| - name: Compute sandbox preview paths | |
| id: urls | |
| run: | | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| COMMIT_HASH="${{ github.event.pull_request.head.sha }}" | |
| SHORT_HASH="${COMMIT_HASH:0:7}" | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| { | |
| echo "short_hash=${SHORT_HASH}" | |
| echo "sandbox_base_path=/${REPO_NAME}/pr/${PR_NUMBER}/sandbox" | |
| echo "template_assets_base_path=/${REPO_NAME}/sandbox/template-assets" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Cache Next.js build | |
| uses: actions/cache@v6 | |
| with: | |
| path: apps/sandbox/.next/cache | |
| # No restore-keys fallback — see deploy.yml for the full rationale. | |
| # The Next.js module cache bakes in @astryxdesign/core's resolved export graph, | |
| # so a loose fallback can restore a cache built against a different | |
| # export shape and silently produce wrong builds (broke #2941's | |
| # post-merge deploy). A changed key yields a cold (safe) rebuild. | |
| # | |
| # Keyed by PR number so PRs never share a cache with main (deploy.yml) | |
| # or with other PRs: each PR builds with its own basePath | |
| # (SANDBOX_BASE_PATH=/<repo>/pr/<n>/sandbox vs /<repo>/sandbox on main), | |
| # and Next.js invalidates the webpack cache whenever the resolved config | |
| # changes — so a cache built under a different basePath always restores | |
| # as dead weight (download cost, zero reuse) and, because the shared key | |
| # "hit", the PR could never save a cache for its own basePath either. | |
| # Re-pushes to the same PR keep the same key and get real warm builds. | |
| # (This job only runs on pull_request events — see the job-level `if:` | |
| # above — so github.event.pull_request.number is always set here.) | |
| key: nextjs-sandbox-pr${{ github.event.pull_request.number }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/core/dist/**') }} | |
| - name: Build Sandbox | |
| run: pnpm -F @astryxdesign/sandbox build | |
| env: | |
| # Must match the deployed Pages path (<owner>.github.io/<repo>/pr/<n>/sandbox). | |
| # Built without the /<repo> prefix, the sandbox's root-absolute asset URLs | |
| # drop that segment and 404 — breaking all styles/JS on the preview. | |
| SANDBOX_BASE_PATH: ${{ steps.urls.outputs.sandbox_base_path }} | |
| SANDBOX_TEMPLATE_ASSETS_BASE_PATH: ${{ steps.urls.outputs.template_assets_base_path }} | |
| NODE_OPTIONS: '--max-old-space-size=8192' | |
| - name: Remove shared assets from preview artifact | |
| run: rm -rf apps/sandbox/out/template-assets | |
| - name: Upload Sandbox artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sandbox-${{ steps.urls.outputs.short_hash }} | |
| path: apps/sandbox/out/ | |
| retention-days: 30 | |
| # Join gate that keeps the historical `build` check name: anything keyed on | |
| # "build" being green (branch protection, tooling, habit) keeps working, and | |
| # it fails when either parallel build fails. build-sandbox is legitimately | |
| # skipped on docsite-only PRs; a skipped build-storybook (merge_group, or a | |
| # failed check-scope) skips this gate too — both match the old single-job | |
| # behavior. | |
| build: | |
| needs: [build-storybook, build-sandbox, typecheck] | |
| if: ${{ github.event_name != 'workflow_dispatch' && !cancelled() && needs.build-storybook.result != 'skipped' }} | |
| runs-on: ubuntu-slim | |
| permissions: {} | |
| steps: | |
| - name: Assert parallel builds succeeded | |
| run: | | |
| echo "build-storybook: ${{ needs.build-storybook.result }}" | |
| echo "build-sandbox: ${{ needs.build-sandbox.result }}" | |
| echo "typecheck: ${{ needs.typecheck.result }}" | |
| [ "${{ needs.build-storybook.result }}" = "success" ] || exit 1 | |
| [ "${{ needs.typecheck.result }}" = "success" ] || exit 1 | |
| case "${{ needs.build-sandbox.result }}" in | |
| success|skipped) ;; | |
| *) exit 1 ;; | |
| esac | |
| # CI keeps Storybook's static artifact for visual, accessibility, and RTL | |
| # checks. The exact-head Vercel deployment independently hosts both human | |
| # Storybook and Sandbox previews; no branch-backed preview is published. | |
| # Accessibility audit | |
| # Skipped when no components changed. Depends only on build-storybook, so it | |
| # starts as soon as the storybook artifact is up (~2min) instead of waiting | |
| # for the slower sandbox build. | |
| # The release check's full axe roster is scanned by three shard jobs and | |
| # joined, with the baseline gate, in pr-a11y-audit, while pr-a11y runs the | |
| # browser guards beside them. Pull requests audit only their scoped owners in | |
| # pr-a11y itself, so neither runs there. | |
| pr-a11y-shard: | |
| name: pr-a11y (${{ matrix.shard }}/${{ strategy.job-total }}) | |
| needs: [build-storybook, check-components] | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' && needs.check-components.outputs.has_components == 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3] | |
| # Four pages on four cores: on 2-core ARM runners each shard's scan took | |
| # 11.5 minutes, the release check's slowest lane after the contracts. | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| - name: Install Playwright | |
| run: pnpm install --frozen-lockfile && npx playwright install chromium | |
| - name: Run accessibility audit shard | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --concurrency 4 \ | |
| --shard "${{ matrix.shard }}/${{ strategy.job-total }}" \ | |
| --shard-output "a11y-shard-${{ matrix.shard }}.json" | |
| - name: Upload accessibility audit shard | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: a11y-shard-${{ needs.build-storybook.outputs.short_hash }}-${{ matrix.shard }} | |
| path: a11y-shard-${{ matrix.shard }}.json | |
| retention-days: 1 | |
| if-no-files-found: error | |
| pr-a11y-audit: | |
| name: pr-a11y (full audit) | |
| needs: [build-storybook, check-components, pr-a11y-shard] | |
| if: ${{ always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' && needs.check-components.outputs.has_components == 'true' }} | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require every audit shard | |
| env: | |
| SHARD_RESULT: ${{ needs.pr-a11y-shard.result }} | |
| run: | | |
| if [ "$SHARD_RESULT" != success ]; then | |
| echo "Accessibility audit shards did not all succeed: $SHARD_RESULT" | |
| exit 1 | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| - name: Download accessibility audit shards | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: a11y-shard-${{ needs.build-storybook.outputs.short_hash }}-* | |
| path: a11y-shards | |
| merge-multiple: true | |
| # Builds the report a single full run would write from the complete | |
| # shard set (or fails), then applies the checked-in baseline. | |
| - name: Run accessibility audit | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output a11y-report.json \ | |
| --merge-shards a11y-shards \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| - name: Upload a11y artifact | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: a11y-report | |
| path: a11y-report.json | |
| retention-days: 1 | |
| pr-a11y: | |
| needs: [build-storybook, check-components] | |
| if: (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) && needs.check-components.outputs.has_components == 'true' | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Verify evidence checkout | |
| if: github.event_name == 'pull_request' | |
| env: | |
| EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD_SHA" | |
| # A contract step added on main after this PR branched names a spec file | |
| # the PR head does not have, and would fail with "No tests found". The | |
| # wrapper, sourced into every later step, drops such files from | |
| # `pnpm exec playwright test` with a notice and passes a step left with | |
| # none. It comes from the merge commit these steps come from (an older PR | |
| # head lacks it, and the PR's recorded base can lag main). | |
| - name: Skip contract specs the PR head predates | |
| if: github.event_name == 'pull_request' | |
| env: | |
| WORKFLOW_SHA: ${{ github.sha }} | |
| run: | | |
| wrapper="$RUNNER_TEMP/skip-absent-specs.sh" | |
| if git fetch --quiet --no-tags --depth=1 origin "$WORKFLOW_SHA" \ | |
| && git show "$WORKFLOW_SHA:.github/scripts/skip-absent-specs.sh" > "$wrapper"; then | |
| echo "BASH_ENV=$wrapper" >> "$GITHUB_ENV" | |
| else | |
| echo "::warning::Could not load the spec wrapper from the merge commit; contract steps run unwrapped." | |
| fi | |
| # Dependencies are installed later, together with the Playwright browser, | |
| # because the analysis artifact has to be downloaded first. | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Download analysis artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: pr-analysis | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| - name: Install Playwright | |
| run: pnpm install --frozen-lockfile && npx playwright install chromium | |
| # Fails on axe violations not present in the checked-in baseline | |
| # (.github/a11y-baseline.json). See CONTRIBUTING.md "Accessibility | |
| # audits" for the baseline workflow. | |
| # Release checks scan the full roster in pr-a11y-shard and gate it in | |
| # pr-a11y-audit; this job keeps the scoped PR audit and the guards. | |
| - name: Run accessibility audit | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| SCOPE_ARGS=() | |
| if [ "${{ github.event_name }}" = 'pull_request' ]; then | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| # An explicit empty filter means no changed components, never all | |
| # stories. Shared-surface full sweeps belong to release-check. | |
| SCOPE_ARGS=(--components "$COMPONENTS") | |
| echo "PR accessibility scope: ${COMPONENTS:-no changed components; fast browser guards still run}" | |
| fi | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output a11y-report.json \ | |
| --concurrency 4 \ | |
| "${SCOPE_ARGS[@]}" \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| # if: always() so the report artifact (and the PR comment built from it) | |
| # still exists when the gate above fails. | |
| - name: Upload a11y artifact | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: a11y-report | |
| path: a11y-report.json | |
| retention-days: 1 | |
| # A modal <dialog> hidden before close() blocks the whole page in Safari | |
| # 26.1 and leaves no trace (#4290). The ordering is produced by a CSS | |
| # transition, which jsdom does not run — so the unit suite cannot see it | |
| # and this Chromium probe is the guard. Runs after the upload above so an | |
| # a11y failure still publishes its report. | |
| - name: Run modal close visibility guard | |
| run: node .github/scripts/modal-close-visibility.js --storybook-dir apps/storybook/dist | |
| # A public component var can be documented, read, and emitted into the | |
| # theme CSS and still be unreachable — an inline write or an unlayered | |
| # declaration outranks `@layer astryx-theme` (#4530). jsdom resolves no | |
| # cascade, so the unit suites assert on the generated CSS text, which | |
| # proves emission and not effect. Chromium is where the promise is | |
| # checkable. The source-side wiring half lives in | |
| # packages/cli/foundation/discovery/theming-targets.test.mjs. | |
| - name: Run theme var reachability guard | |
| run: node .github/scripts/theme-var-reachability.js --storybook-dir apps/storybook/dist | |
| # A story play function is where geometry assertions live (they need | |
| # getBoundingClientRect, so jsdom is out), but nothing else observes the | |
| # result: Vitest never collects stories, and pr-visual loads stories | |
| # without awaiting `play` — and is soft while it earns trust. This guard | |
| # loads each listed story in Chromium and fails when its play assertions | |
| # throw. Hosted here with the sibling Chromium guards because pr-a11y is | |
| # the blocking job that runs whenever components change. | |
| - name: Run story play guard | |
| run: node .github/scripts/story-play-guard.js --storybook-dir apps/storybook/dist | |
| # The empty-state announcement is a live-region claim: what a screen | |
| # reader receives when a search dead-ends, and that the message element | |
| # stays presentational so `role="listbox"` keeps only option/group | |
| # children. jsdom proves the wiring; only a real engine shows the | |
| # accessibility tree that results, and this contract is cheap enough to | |
| # run on every PR rather than waiting for the release matrix. Its own | |
| # --output directory so a later audit run cannot clear it, and it cannot | |
| # clear theirs (Playwright wipes the default directory per run). | |
| - name: Run empty-state announcement contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Selector/__tests__/EmptyStateAnnouncement.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output empty-state-announcement-output | |
| # A disabled MultiSelector trigger keeps focus when it is disabled while | |
| # focused. jsdom never moves focus off a newly disabled element, so only | |
| # a real engine shows the loss this guards against. | |
| - name: Run MultiSelector disabled-focus contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output multiselector-disabled-focus-output | |
| # In a right-to-left page Lightbox's Next button sits on the left, and | |
| # the arrow keys must move toward the button on their side. The | |
| # direction reaches the top-layer dialog through the engine's own | |
| # cascade, which jsdom does not inherit. | |
| - name: Run Lightbox arrow-key direction contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Lightbox/LightboxKeyboard.a11y.browser.spec.ts \ | |
| --project chromium \ | |
| --output lightbox-keyboard-output | |
| # The same guard for Selector and ComplexSelector triggers. | |
| - name: Run disabled trigger focus contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/__tests__/DisabledTriggerFocus.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output disabled-trigger-focus-output | |
| # A pinch that starts on, or reaches, a Lab reorder grip (ListInput, | |
| # TransferList) must zoom the page (WCAG 1.4.4), while a one-finger drag | |
| # on the grip still reorders. touch-action and pinch-zoom only exist in a | |
| # real engine with two-finger touch input. | |
| - name: Run Lab reorder grip pinch-zoom contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output reorder-grip-pinch-zoom-output | |
| # Table merges a consumer min-width with its column floors through CSS | |
| # max(). jsdom keeps any string, so only a real engine shows whether the | |
| # emitted declaration parses; an invalid one drops the floors entirely. | |
| - name: Run Table min-width contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Table/__tests__/TableMinWidth.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output table-min-width-output | |
| # A CodeBlock diff row's tint has to follow a long line to the end of its | |
| # scroll width; jsdom has no layout, so only a real engine shows whether | |
| # the paint stops at the viewport edge when the reader scrolls. | |
| - name: Run CodeBlock diff row paint contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/CodeBlock/__tests__/DiffRowPaint.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output codeblock-diff-row-paint-output | |
| # A CodeBlock viewport is a Tab stop only while its code overflows; jsdom | |
| # has no layout, so only a real engine shows the stop appear with a wide | |
| # or capped block and stay away from a short one. | |
| - name: Run CodeBlock overflow tab-stop contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/CodeBlock/__tests__/CodeBlockOverflowStop.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output codeblock-overflow-stop-output | |
| # A DropdownMenu header and footer sit beside the menu, outside its | |
| # role="menu" element, and join one Tab sequence with it. Focus order, | |
| # the popover's focus trap, the keyboard-only ring and a finger tap on a | |
| # footer control only exist in a real engine. | |
| - name: Run DropdownMenu header and footer contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/MenuHeaderFooter.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output menu-header-footer-output | |
| # A menu inside a shadow root must act on the row under a released | |
| # pointer; at the document level a real engine resolves that point to | |
| # the shadow host, which jsdom cannot show. | |
| - name: Run menu press shadow-root contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output menu-press-shadow-root-output | |
| # A two-finger pinch over an open picker wheel must zoom the page (WCAG | |
| # 1.4.4) while one finger still scrolls the wheel. jsdom computes no | |
| # touch-action, so only a real engine shows which gesture the browser | |
| # keeps. | |
| - name: Run picker wheel pinch-zoom contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output wheel-pinch-zoom-output | |
| # A sub-menu with a header or footer is a modal dialog beside the root's | |
| # menu, outside every role="menu" element. Its Tab order, a header radio | |
| # group the browser moves focus in after the pointer leaves, the | |
| # press-drag pick and the phone drill-in only exist in a real engine. | |
| - name: Run DropdownMenu sub-menu header and footer contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/SubMenuHeaderFooter.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output submenu-header-footer-output | |
| # Tooltip and HoverCard answer a touch only once it is a tap: they open | |
| # when the finger lifts, never for a touch that turns into a scroll, and | |
| # a tap-opened layer closes when a tap outside lifts. Whether a touch is | |
| # a tap, a scroll or a long press is the engine's own gesture decision, | |
| # which only real touch input reaches. | |
| - name: Run hover layer touch contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Layer/__tests__/TouchTrigger.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output hover-layer-touch-output | |
| # A pointer that crosses from a Tooltip's trigger onto the tooltip in one | |
| # step must not lose it (WCAG 1.4.13 hoverable). The defect is in the | |
| # order the engine dispatches mouseout and mouseleave on that step, which | |
| # only a real engine produces. | |
| - name: Run Tooltip hover bridge contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Tooltip/__tests__/TooltipHoverBridge.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output tooltip-hover-bridge-output | |
| # A Token's remove target is enlarged past its 16px X, and only a real | |
| # engine hit-tests it: a press on the end of the value beside the X must | |
| # run the token's own action, and a press just outside the X must remove. | |
| - name: Run Token remove target contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Token/__tests__/TokenRemoveTarget.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output token-remove-target-output | |
| # On a phone-width screen AppShell shows TopNav's compact bar. A long | |
| # heading must give way so the menu toggle stays inside the bar and the | |
| # drawer's close button stays inside the drawer; only a real engine lays | |
| # them out. | |
| - name: Run TopNav mobile long heading contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/TopNav/__tests__/TopNavMobileLongHeading.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output top-nav-mobile-long-heading-output | |
| # A pinch that starts on a row with swipe actions must zoom the page | |
| # (WCAG 1.4.4) and leave the row where it is, whichever finger lands | |
| # first, while a one-finger sideways drag still swipes. Pinch-zoom and | |
| # touch-action only exist in a real engine with two-finger touch input. | |
| - name: Run Item swipe pinch-zoom contract | |
| run: | | |
| pnpm exec playwright test \ | |
| packages/core/src/Item/__tests__/ItemSwipePinchZoom.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output item-swipe-pinch-zoom-output | |
| # The RichTextEditor "Markdown parity" stories render one Markdown | |
| # document with core Markdown and RichTextEditor and measure where each | |
| # block lands; geometry, the read/edit switch and the scroll anchor only | |
| # exist in a real engine. The spec proves the sandbox still works and | |
| # banks screenshots plus a geometry manifest of today's differences. It | |
| # asserts no parity. A pull request runs it only when it can change what | |
| # the sandbox shows: Markdown or a RichText component is in the PR scope, | |
| # the RichText package changed, or the sandbox's own stories or spec | |
| # changed. Release-check always runs it. Its own --output directory, with | |
| # the upload immediately after. | |
| - name: Run Markdown/RichText parity sandbox evidence | |
| id: markdown-parity | |
| if: ${{ !cancelled() }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| run: | | |
| should_run=true | |
| if [ "${{ github.event_name }}" = 'pull_request' ]; then | |
| should_run=false | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,core/Markdown,* | *,richtext/*) should_run=true ;; | |
| esac | |
| if node -e "process.exit(require('./analysis.json').changedPackages?.includes('@astryxdesign/richtext') ? 0 : 1)"; then | |
| should_run=true | |
| fi | |
| # The sandbox's stories belong to no package, so compare the file | |
| # names the PR changes since its merge base. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(apps/storybook/stories/RichTextEditor\.(markdownParity|stories)|packages/richtext/src/__tests__/(MarkdownParitySandbox|RichTextView|RichTextEditorToolbar))' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Markdown, RichText, and the parity sandbox are not in PR scope; skipping parity evidence." | |
| exit 0 | |
| fi | |
| # The RichTextView typography and RichText toolbar layout specs share | |
| # this scope, so they ride the same gate and output directory. | |
| pnpm exec playwright test \ | |
| packages/richtext/src/__tests__/MarkdownParitySandbox.a11y.chromium.spec.ts \ | |
| packages/richtext/src/__tests__/RichTextView.a11y.chromium.spec.ts \ | |
| packages/richtext/src/__tests__/RichTextEditorToolbar.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output richtext-markdown-parity-output | |
| - name: Upload Markdown/RichText parity sandbox evidence | |
| if: ${{ !cancelled() && steps.markdown-parity.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: richtext-markdown-parity-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: test-results/richtext-markdown-parity/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # Outline owns real DOM focus through roving tabindex. Computed paint, | |
| # pointer modality, clipping, forced colors, and exact pixels require the | |
| # same real Chromium artifact this blocking accessibility lane already owns. | |
| - name: Run Outline focus indicator contract | |
| if: github.event_name == 'pull_request' | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,core/Outline,*) | |
| pnpm exec playwright test \ | |
| packages/core/src/Outline/OutlineFocus.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output outline-focus-output | |
| ;; | |
| *) echo "Outline not in PR scope; skipping focus evidence." ;; | |
| esac | |
| - name: Upload Outline focus evidence | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: outline-focus-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: test-results/outline-focus-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| # The toggle-button contract's pressed state, keyboard and pointer round | |
| # trips, aborted press, focus, and unavailable state are accessibility-tree | |
| # and engine facts that jsdom cannot observe. Run the contract's own | |
| # fixture proof and the ToggleButton binding whenever the PR scope names | |
| # ToggleButton or the contract changes. Its own --output directory; the | |
| # JSON report is the head-bound record, uploaded immediately after. | |
| - name: Run ToggleButton accessibility contract | |
| id: toggle-button-contract | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: toggle-button-contract/report.json | |
| run: | | |
| should_run=false | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,core/ToggleButton,*) should_run=true ;; | |
| esac | |
| # The contract belongs to no package, so compare the file names the | |
| # PR changes since its merge base. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^internal/a11y-spec/src/patterns/toggle-button' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "ToggleButton and its contract are not in PR scope; skipping toggle-button evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/toggle-button.chromium.spec.ts \ | |
| packages/core/src/ToggleButton/__tests__/ToggleButton.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output toggle-button-contract-output | |
| - name: Upload ToggleButton accessibility contract evidence | |
| if: ${{ !cancelled() && steps.toggle-button-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: toggle-button-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: toggle-button-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The landmark contract's role, name, and repeated-label outcomes are | |
| # accessibility-tree facts that jsdom cannot observe. Run the contract's | |
| # own fixture proof and the Layout regions binding whenever Layout source, | |
| # the binding's stories, or the contract changes. Its own --output | |
| # directory; the JSON report is the head-bound record, uploaded next. | |
| - name: Run Landmark accessibility contract | |
| id: landmark-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: landmark-contract/report.json | |
| run: | | |
| should_run=false | |
| # Layout and the contract are matched by file name so every Layout | |
| # region component is covered. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/landmark|packages/core/src/Layout/|apps/storybook/stories/LayoutLandmarkA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Layout and the landmark contract are not in PR scope; skipping landmark evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/landmark.chromium.spec.ts \ | |
| packages/core/src/Layout/__tests__/Layout.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output landmark-contract-output | |
| - name: Upload Landmark accessibility contract evidence | |
| if: ${{ !cancelled() && steps.landmark-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: landmark-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: landmark-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The menu-button contract's control role and name, the focus landing on | |
| # Enter, Space, ArrowDown, and ArrowUp opens, and the pointer round trip | |
| # are accessibility-tree and real-browser facts that jsdom cannot observe. | |
| # Run the contract's own fixture proof and the DropdownMenu/MoreMenu | |
| # binding whenever either component's source, the binding's stories, or | |
| # the contract changes. Its own --output directory; the JSON report is | |
| # the head-bound record, uploaded next. | |
| - name: Run Menu Button accessibility contract | |
| id: menu-button-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: menu-button-contract/report.json | |
| run: | | |
| should_run=false | |
| # DropdownMenu, MoreMenu, and the contract are matched by file name. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/menu-button|packages/core/src/DropdownMenu/|packages/core/src/MoreMenu/|apps/storybook/stories/MenuButtonA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "DropdownMenu, MoreMenu, and the menu-button contract are not in PR scope; skipping menu-button evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/menu-button.chromium.spec.ts \ | |
| packages/core/src/DropdownMenu/__tests__/MenuButton.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output menu-button-contract-output | |
| - name: Upload Menu Button accessibility contract evidence | |
| if: ${{ !cancelled() && steps.menu-button-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: menu-button-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: menu-button-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The menu contract's role and name, item roles, and the arrow, Home/End, | |
| # typeahead, Enter, Escape and Tab transitions are accessibility-tree and | |
| # real-browser facts that jsdom cannot observe. Run the contract's own | |
| # fixture proof and the DropdownMenu pointer-menu binding whenever | |
| # DropdownMenu source, the binding's stories, or the contract changes. | |
| # Its own --output directory; the JSON report is the head-bound record, | |
| # uploaded next. | |
| - name: Run Menu accessibility contract | |
| id: menu-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: menu-contract/report.json | |
| run: | | |
| should_run=false | |
| # DropdownMenu and the contract are matched by file name. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/menu\.|packages/core/src/DropdownMenu/|apps/storybook/stories/MenuA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "DropdownMenu and the menu contract are not in PR scope; skipping menu evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/menu.chromium.spec.ts \ | |
| packages/core/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output menu-contract-output | |
| - name: Upload Menu accessibility contract evidence | |
| if: ${{ !cancelled() && steps.menu-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: menu-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: menu-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The toolbar contract's role and name, the controls inside it, the single | |
| # Tab stop, and the arrow (wrap, RTL, vertical) and Home/End movement are | |
| # accessibility-tree and real-browser facts that jsdom cannot observe. Run | |
| # the contract's own fixture proof and the Toolbar binding whenever | |
| # Toolbar source, the binding's stories, or the contract changes. Its own | |
| # --output directory; the JSON report is the head-bound record, uploaded | |
| # next. | |
| - name: Run Toolbar accessibility contract | |
| id: toolbar-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: toolbar-contract/report.json | |
| run: | | |
| should_run=false | |
| # Toolbar and the contract are matched by file name. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/toolbar\.|packages/core/src/Toolbar/|apps/storybook/stories/ToolbarA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Toolbar and the toolbar contract are not in PR scope; skipping toolbar evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/toolbar.chromium.spec.ts \ | |
| packages/core/src/Toolbar/__tests__/Toolbar.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output toolbar-contract-output | |
| - name: Upload Toolbar accessibility contract evidence | |
| if: ${{ !cancelled() && steps.toolbar-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: toolbar-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: toolbar-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The Chromium harness's own self-tests: what it reads from the engine's | |
| # accessibility tree, rendered visibility, and the pointer primitives | |
| # (hover, pointerAway) contracts drive. Run them whenever the harness | |
| # changes, so a harness change carries its own browser evidence. | |
| - name: Run accessibility harness self-tests | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| run: | | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" '^internal/a11y-spec/src/harness' || scope=$? | |
| fi | |
| if [ "$scope" = 1 ]; then | |
| echo "The accessibility harness is not in PR scope; skipping its self-tests." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/harness/chromium.chromium.spec.ts \ | |
| --project chromium \ | |
| --output a11y-harness-output | |
| # The tooltip contract's computed description, focus and hover showing, | |
| # Escape and focus-leaving dismissal, and staying while hovered are | |
| # accessibility-tree and real-browser facts that jsdom cannot observe. Run | |
| # the contract's own fixture proof and the Tooltip binding whenever | |
| # Tooltip source, the binding's stories, or the contract changes. Its own | |
| # --output directory; the JSON report is the head-bound record, uploaded | |
| # next. | |
| - name: Run Tooltip accessibility contract | |
| id: tooltip-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: tooltip-contract/report.json | |
| run: | | |
| should_run=false | |
| # Tooltip and the contract are matched by file name. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/tooltip\.|packages/core/src/Tooltip/|apps/storybook/stories/TooltipA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Tooltip and the tooltip contract are not in PR scope; skipping tooltip evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/tooltip.chromium.spec.ts \ | |
| packages/core/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output tooltip-contract-output | |
| - name: Upload Tooltip accessibility contract evidence | |
| if: ${{ !cancelled() && steps.tooltip-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: tooltip-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: tooltip-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The accordion contract's header role and name, the page Tab step between | |
| # headers, the absence of arrow-key focus movement, and the single-expansion | |
| # sibling collapse are accessibility-tree and real-browser facts that jsdom | |
| # cannot observe. Run the contract's own fixture proof and the | |
| # CollapsibleGroup binding whenever Collapsible source, the binding's | |
| # stories, or the contract changes. Its own --output directory; the JSON | |
| # report is the head-bound record, uploaded next. | |
| - name: Run Accordion accessibility contract | |
| id: accordion-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: accordion-contract/report.json | |
| run: | | |
| should_run=false | |
| # Collapsible and the contract are matched by file name. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/accordion|packages/core/src/Collapsible/|apps/storybook/stories/CollapsibleGroupA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "CollapsibleGroup and the accordion contract are not in PR scope; skipping accordion evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/accordion.chromium.spec.ts \ | |
| packages/core/src/Collapsible/__tests__/CollapsibleGroupAccordion.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output accordion-contract-output | |
| - name: Upload Accordion accessibility contract evidence | |
| if: ${{ !cancelled() && steps.accordion-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: accordion-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: accordion-contract/ | |
| # The slider contract's thumb role and name, and its arrow, Page, Home and | |
| # End results, are accessibility-tree and real-browser facts that jsdom | |
| # cannot observe. Run the contract's own fixture proof and the Slider | |
| # binding whenever Slider, the harness, the binding's stories, or the | |
| # contract changes. Its own --output directory; the JSON report is the | |
| # head-bound record, uploaded next. | |
| - name: Run Slider accessibility contract | |
| id: slider-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: slider-contract/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/slider|internal/a11y-spec/src/harness|packages/core/src/Slider/|apps/storybook/stories/SliderA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Slider and the slider contract are not in PR scope; skipping slider evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/slider.chromium.spec.ts \ | |
| packages/core/src/Slider/__tests__/Slider.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output slider-contract-output | |
| - name: Upload Slider accessibility contract evidence | |
| if: ${{ !cancelled() && steps.slider-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: slider-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: slider-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The progressbar contract's role and name, value and range, indeterminate | |
| # state, and value text are accessibility-tree facts that jsdom cannot | |
| # observe. Run the contract's own fixture proof and the ProgressBar and | |
| # CircularProgress bindings whenever either component, the binding | |
| # stories, or the contract changes. Its own --output directory; the JSON | |
| # report is the head-bound record, uploaded next. | |
| - name: Run Progressbar accessibility contract | |
| id: progressbar-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: progressbar-contract/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/progressbar\.|packages/core/src/ProgressBar/|packages/lab/src/CircularProgress/|apps/storybook/stories/ProgressbarA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "ProgressBar, CircularProgress and the progressbar contract are not in PR scope; skipping progressbar evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/progressbar.chromium.spec.ts \ | |
| packages/core/src/ProgressBar/__tests__/ProgressBar.a11y.chromium.spec.ts \ | |
| packages/lab/src/CircularProgress/__tests__/CircularProgress.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output progressbar-contract-output | |
| - name: Upload Progressbar accessibility contract evidence | |
| if: ${{ !cancelled() && steps.progressbar-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: progressbar-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: progressbar-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # A treeitem's computed name and description are accessibility-tree facts | |
| # jsdom approximates but a browser decides. Run the TreeList row-naming | |
| # evidence whenever TreeList, its focus hook, or the story changes. | |
| - name: Run TreeList row-naming evidence | |
| id: treelist-row-names | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: treelist-row-names/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(packages/core/src/TreeList/|packages/core/src/hooks/useTreeFocus|apps/storybook/stories/TreeListA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "TreeList is not in PR scope; skipping row-naming evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| packages/core/src/TreeList/__tests__/TreeListRowNames.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output treelist-row-names-output | |
| - name: Upload TreeList row-naming evidence | |
| if: ${{ !cancelled() && steps.treelist-row-names.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: treelist-row-names-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: treelist-row-names/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The tree-view contract's roles and names, one Tab stop, arrow/Home/End, | |
| # Enter and typeahead movement are accessibility-tree and real-browser | |
| # facts that jsdom cannot observe. Run the contract's own fixture proof | |
| # and the TreeList binding whenever TreeList, its focus hook, the | |
| # binding's stories, or the contract changes. Its own --output directory; | |
| # the JSON report is the head-bound record, uploaded next. | |
| - name: Run Tree View accessibility contract | |
| id: tree-view-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: tree-view-contract/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/tree-view|internal/a11y-spec/src/harness|packages/core/src/TreeList/|packages/core/src/hooks/useTreeFocus|apps/storybook/stories/TreeListTreeViewA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "TreeList and the tree-view contract are not in PR scope; skipping tree-view evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/tree-view.chromium.spec.ts \ | |
| packages/core/src/TreeList/__tests__/TreeList.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output tree-view-contract-output | |
| - name: Upload Tree View accessibility contract evidence | |
| if: ${{ !cancelled() && steps.tree-view-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: tree-view-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: tree-view-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The carousel contract's collection and slide names, off-screen slide | |
| # exposure, scroll-area keyboard entry and exit, and control focus are | |
| # accessibility-tree and engine facts that jsdom cannot observe. Run the | |
| # contract's own fixture proof and the Carousel binding whenever Carousel | |
| # source, the binding's stories, or the contract changes. Its own --output | |
| # directory; the JSON report is the head-bound record, uploaded next. | |
| - name: Run Carousel accessibility contract | |
| id: carousel-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: carousel-contract/report.json | |
| run: | | |
| should_run=false | |
| # Carousel and the contract are matched by file name. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/carousel|packages/core/src/Carousel/|apps/storybook/stories/CarouselA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Carousel and the carousel contract are not in PR scope; skipping carousel evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/carousel.chromium.spec.ts \ | |
| packages/core/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output carousel-contract-output | |
| - name: Upload Carousel accessibility contract evidence | |
| if: ${{ !cancelled() && steps.carousel-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: carousel-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: carousel-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The alert-dialog contract's role, name, modality, initial focus, Escape | |
| # and click-beside outcomes are accessibility-tree and real-browser facts | |
| # that jsdom cannot observe. Run the contract's own fixture proof and the | |
| # AlertDialog binding whenever AlertDialog, Dialog, the harness, the | |
| # binding's stories, or the contract changes. Its own --output | |
| # directory; the JSON report is the head-bound record, uploaded next. | |
| - name: Run Alert Dialog accessibility contract | |
| id: alert-dialog-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: alert-dialog-contract/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/alert-dialog|internal/a11y-spec/src/harness|packages/core/src/AlertDialog/|packages/core/src/Dialog/|apps/storybook/stories/AlertDialogA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "AlertDialog and the alert-dialog contract are not in PR scope; skipping alert-dialog evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/alert-dialog.chromium.spec.ts \ | |
| packages/core/src/AlertDialog/__tests__/AlertDialog.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output alert-dialog-contract-output | |
| - name: Upload Alert Dialog accessibility contract evidence | |
| if: ${{ !cancelled() && steps.alert-dialog-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: alert-dialog-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: alert-dialog-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The grid contract's role and name, and its arrow, Home, End and Enter | |
| # results, are accessibility-tree and real-browser facts that jsdom cannot | |
| # observe. Run the contract's own fixture proof and the Calendar binding | |
| # whenever Calendar, the grid-focus hook, the harness, the binding's | |
| # stories, or the contract changes. Its own --output directory; the JSON | |
| # report is the head-bound record, uploaded next. | |
| - name: Run Grid accessibility contract | |
| id: grid-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: grid-contract/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/grid|internal/a11y-spec/src/harness|packages/core/src/Calendar/|packages/core/src/hooks/useGridFocus|apps/storybook/stories/CalendarGridA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Calendar and the grid contract are not in PR scope; skipping grid evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/grid.chromium.spec.ts \ | |
| packages/core/src/Calendar/__tests__/Calendar.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output grid-contract-output | |
| - name: Upload Grid accessibility contract evidence | |
| if: ${{ !cancelled() && steps.grid-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: grid-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: grid-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The window-splitter contract's separator role and name, its pane | |
| # relationship, and its arrow, Enter, Home and End results are | |
| # accessibility-tree and real-browser facts that jsdom cannot observe. | |
| # Run the contract's own fixture proof and the ResizeHandle binding | |
| # whenever Resizable, the harness, the binding's stories, or the contract | |
| # changes. Its own --output directory; the JSON report is the | |
| # head-bound record, uploaded next. | |
| - name: Run Window Splitter accessibility contract | |
| id: window-splitter-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: window-splitter-contract/report.json | |
| run: | | |
| should_run=false | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/window-splitter|internal/a11y-spec/src/harness|packages/core/src/Resizable/|apps/storybook/stories/WindowSplitterA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Resizable and the window-splitter contract are not in PR scope; skipping window-splitter evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/window-splitter.chromium.spec.ts \ | |
| packages/core/src/Resizable/__tests__/ResizeHandle.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output window-splitter-contract-output | |
| - name: Upload Window Splitter accessibility contract evidence | |
| if: ${{ !cancelled() && steps.window-splitter-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: window-splitter-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: window-splitter-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The link contract's role, name, Tab, Enter, and pointer-release outcomes | |
| # are accessibility-tree and real-browser facts that jsdom cannot observe. | |
| # Run the contract's own fixture proof and the Link binding whenever Link | |
| # source, the binding's stories, or the contract changes. Its own --output | |
| # directory; the JSON report is the head-bound record, uploaded next. | |
| - name: Run Link accessibility contract | |
| id: link-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: link-contract/report.json | |
| run: | | |
| should_run=false | |
| # Link and the contract are matched by file name so every Link source | |
| # file, including LinkProvider, is covered. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/link\.|packages/core/src/Link/|apps/storybook/stories/LinkA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Link and the link contract are not in PR scope; skipping link evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/link.chromium.spec.ts \ | |
| packages/core/src/Link/__tests__/Link.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output link-contract-output | |
| - name: Upload Link accessibility contract evidence | |
| if: ${{ !cancelled() && steps.link-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: link-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: link-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The combobox contract's accessible name and its popup and | |
| # active-descendant relationships are accessibility-tree facts that jsdom | |
| # cannot observe. Run the contract's own fixture proof and the Selector | |
| # binding whenever the PR scope names Selector, or the contract or its | |
| # audit story changes. Its own --output directory; the JSON report is the | |
| # head-bound record, uploaded next. | |
| - name: Run Combobox accessibility contract | |
| id: combobox-contract | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_FILE: combobox-contract/report.json | |
| run: | | |
| should_run=false | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,core/Selector,*) should_run=true ;; | |
| esac | |
| # The contract belongs to no package, so compare the file names the | |
| # PR changes since its merge base. | |
| # The helper comes from the base, since an older PR head lacks it. | |
| # Exit 1 means out of scope; 0 in scope; 2 unknown, so run. | |
| scope=2 | |
| helper="$(mktemp)" | |
| if git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" \ | |
| && git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then | |
| scope=0 | |
| bash "$helper" "$BASE_SHA" \ | |
| '^(internal/a11y-spec/src/patterns/combobox|apps/storybook/stories/ComboboxA11y)' || scope=$? | |
| fi | |
| if [ "$scope" != 1 ]; then | |
| should_run=true | |
| fi | |
| echo "should_run=${should_run}" >> "$GITHUB_OUTPUT" | |
| if [ "$should_run" != true ]; then | |
| echo "Selector and the combobox contract are not in PR scope; skipping combobox evidence." | |
| exit 0 | |
| fi | |
| pnpm exec playwright test \ | |
| internal/a11y-spec/src/patterns/combobox.chromium.spec.ts \ | |
| packages/core/src/Selector/__tests__/Selector.combobox.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --reporter list,json \ | |
| --output combobox-contract-output | |
| - name: Upload Combobox accessibility contract evidence | |
| if: ${{ !cancelled() && steps.combobox-contract.outputs.should_run == 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: combobox-contract-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: combobox-contract/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| # The Schedule time grid owns scroll geometry — pinned header and gutter | |
| # alignment under classic scrollbars, inline scroll ownership, keyboard | |
| # reach and its focus ring — none of which exists in jsdom. Every | |
| # contract file under the Schedule tests directory runs here, in the | |
| # same real Chromium artifact, whenever the PR scope names Schedule. | |
| - name: Run Schedule time-grid contract | |
| if: github.event_name == 'pull_request' | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,lab/Schedule,*) | |
| pnpm exec playwright test \ | |
| packages/lab/src/Schedule/__tests__/ \ | |
| --project chromium \ | |
| --output schedule-time-grid-output | |
| ;; | |
| *) echo "Schedule not in PR scope; skipping time-grid evidence." ;; | |
| esac | |
| - name: Upload Schedule time-grid evidence | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: schedule-time-grid-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: test-results/schedule-time-grid-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| # The heading-links module contract is broader than axe: exact fragments, | |
| # native sibling anchors, hover/focus/touch discovery, forced colors, | |
| # reduced motion, dark mode, and RTL geometry all need a real engine. | |
| # Keep it scoped to Markdown plugin changes and bind its receipt to the verified head. | |
| - name: Run heading-links module browser evidence | |
| id: markdown-heading-links | |
| if: github.event_name == 'pull_request' | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,core/Markdown,*) | |
| # An older PR head can lack the spec (the wrapper then skips | |
| # it), and it would leave nothing for the upload to find. | |
| if [ -e packages/core/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts ]; then | |
| echo 'should_run=true' >> "$GITHUB_OUTPUT" | |
| else | |
| echo 'should_run=false' >> "$GITHUB_OUTPUT" | |
| fi | |
| pnpm exec playwright test \ | |
| packages/core/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --output markdown-heading-links-output | |
| ;; | |
| *) | |
| echo 'should_run=false' >> "$GITHUB_OUTPUT" | |
| echo "Markdown not in PR scope; skipping heading-link evidence." | |
| ;; | |
| esac | |
| - name: Upload heading-links module browser evidence | |
| if: always() && github.event_name == 'pull_request' && steps.markdown-heading-links.outputs.should_run == 'true' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: markdown-heading-links-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: test-results/markdown-heading-links/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # ChatMessageBubble is nested under the shared Chat source directory, so | |
| # the generic stable-visual owner cannot select its dedicated fixture. | |
| # Run the component's bounded evidence matrix only when the PR scope names | |
| # it, and upload the receipted frames below. | |
| - name: Run ChatMessageBubble audit browser evidence | |
| if: github.event_name == 'pull_request' | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| COMPONENTS=$(node .github/scripts/a11y-pr-scope.mjs analysis.json) | |
| case ",${COMPONENTS}," in | |
| *,core/ChatMessageBubble,*) | |
| pnpm exec playwright test \ | |
| packages/core/src/Chat/__tests__/ChatMessageBubble.a11y.chromium.spec.ts \ | |
| --project chromium | |
| ;; | |
| *) echo "ChatMessageBubble not in PR scope; skipping audit evidence." ;; | |
| esac | |
| - name: Upload ChatMessageBubble audit evidence | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chat-message-bubble-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: test-results/chat-message-bubble-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| # A component audit needs evidence for each state it scores. The generic | |
| # visual manifest does not include semantic-state or geometry sensors, so | |
| # this existing Chromium owner captures bounded, fail-closed receipts. | |
| - name: Run ChatMessageList audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatMessageList:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output chat-message-list-a11y-report.json \ | |
| --components ChatMessageList \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/Chat/__tests__/ChatMessageList.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload ChatMessageList audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatMessageList:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chat-message-list-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| chat-message-list-a11y-report.json | |
| test-results/chat-message-list-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| # CommandPaletteFooter's default and replacement branches live inside the | |
| # parent dialog. Its owned stories keep those branches routable so exact- | |
| # head Chromium can measure semantics, theme reach, RTL order, and reflow. | |
| - name: Run CommandPaletteFooter audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPaletteFooter:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output command-palette-footer-a11y-report.json \ | |
| --components CommandPaletteFooter \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/CommandPalette/__tests__/CommandPaletteFooter.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload CommandPaletteFooter audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPaletteFooter:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: command-palette-footer-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| command-palette-footer-a11y-report.json | |
| test-results/command-palette-footer-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # CollapsibleGroup's shared Collapsible story previously left the audit | |
| # owner with no routable browser fixture. Its dedicated matrix now emits | |
| # semantic-state, geometry, direction, theme, and viewport receipts. | |
| - name: Run CollapsibleGroup audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CollapsibleGroup:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output collapsible-group-a11y-report.json \ | |
| --components CollapsibleGroup \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/Collapsible/__tests__/CollapsibleGroup.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload CollapsibleGroup audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CollapsibleGroup:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: collapsible-group-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| collapsible-group-a11y-report.json | |
| test-results/collapsible-group-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # CommandPalette's interactive stories previously rendered only closed | |
| # triggers. Its owned matrix keeps grouped, empty, and pending anatomy | |
| # reachable for semantic, contrast, direction, and viewport receipts. | |
| - name: Run CommandPalette audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPalette:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output command-palette-a11y-report.json \ | |
| --components CommandPalette \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/CommandPalette/__tests__/CommandPalette.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload CommandPalette audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPalette:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: command-palette-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| command-palette-a11y-report.json | |
| test-results/command-palette-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # CommandPaletteInput owns a standalone searchbox and contextual combobox. | |
| # Its audit lane keeps the visible keyboard-focus, theme, direction, | |
| # responsive, empty, and pending receipts bound to the exact PR head. | |
| - name: Run CommandPaletteInput audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPaletteInput:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output command-palette-input-a11y-report.json \ | |
| --components CommandPaletteInput \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/CommandPalette/__tests__/CommandPaletteInputAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload CommandPaletteInput audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPaletteInput:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: command-palette-input-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| command-palette-input-a11y-report.json | |
| command-palette-input-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # CommandPaletteItem owns the option semantics and visible result states. | |
| # Its audit lane keeps state, theme, direction, and narrow receipts bound | |
| # to the exact PR head without changing the component's public contract. | |
| - name: Run CommandPaletteItem audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPaletteItem:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output command-palette-item-a11y-report.json \ | |
| --components CommandPaletteItem \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/CommandPalette/__tests__/CommandPaletteItemAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload CommandPaletteItem audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] CommandPaletteItem:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: command-palette-item-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| command-palette-item-a11y-report.json | |
| command-palette-item-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # FieldLabel owns native and group labelling, hidden text, optionality, | |
| # descriptions, and delegated icon/tooltip presentation. Its audit lane | |
| # keeps those states bound to exact-head themes, direction, and viewport. | |
| - name: Run FieldLabel audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] FieldLabel:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output field-label-a11y-report.json \ | |
| --components FieldLabel \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/Field/__tests__/FieldLabelAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload FieldLabel audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] FieldLabel:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: field-label-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| field-label-a11y-report.json | |
| field-label-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # Component-owned metadata fixtures retain exact-head browser receipts on | |
| # audit PRs, including failed pre-fix cases for before/after comparison. | |
| - name: Run ChatMessageMetadata audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatMessageMetadata:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output chat-message-metadata-a11y-report.json \ | |
| --components ChatMessageMetadata \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload ChatMessageMetadata audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatMessageMetadata:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chat-message-metadata-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| chat-message-metadata-a11y-report.json | |
| test-results/chat-message-metadata-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| # ChatSendButton's component audit grades real interaction paint, disabled | |
| # stability, both sizes, and narrow coarse-pointer geometry. Keep those | |
| # receipts exact-head and bounded to its audit PR title. | |
| - name: Run ChatSendButton audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatSendButton:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output chat-send-button-a11y-report.json \ | |
| --components ChatSendButton \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/Chat/__tests__/ChatSendButton.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload ChatSendButton audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatSendButton:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chat-send-button-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| chat-send-button-a11y-report.json | |
| test-results/chat-send-button-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # ChatSystemMessage is noninteractive, but its status/separator semantics, | |
| # delegated paint, contrast, and narrow reflow still require exact-head | |
| # browser receipts rather than source-only claims. | |
| - name: Run ChatSystemMessage audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatSystemMessage:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output chat-system-message-a11y-report.json \ | |
| --components ChatSystemMessage \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/Chat/__tests__/ChatSystemMessage.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload ChatSystemMessage audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatSystemMessage:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chat-system-message-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| chat-system-message-a11y-report.json | |
| test-results/chat-system-message-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # ChatTokenizedText is noninteractive, but its literal matching, delegated | |
| # token paint, light/dark rendering, and narrow reflow require exact-head | |
| # browser receipts for the state matrix graded by its component audit. | |
| - name: Run ChatTokenizedText audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatTokenizedText:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| ASTRYX_AUDIT_BASELINE_HEAD: a7c6c7ecdf6b422df331124e8f6fc6d33cf1bd63 | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output chat-tokenized-text-a11y-report.json \ | |
| --components ChatTokenizedText \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| pnpm exec playwright test \ | |
| packages/core/src/Chat/__tests__/ChatTokenizedText.a11y.chromium.spec.ts \ | |
| --project chromium | |
| - name: Upload ChatTokenizedText audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ChatTokenizedText:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chat-tokenized-text-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| chat-tokenized-text-a11y-report.json | |
| test-results/chat-tokenized-text-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DropdownMenuGroup is a hidden compound subcomponent, so the dedicated | |
| # story and sensor lane keep named and unnamed group semantics, heading | |
| # paint, target placement, keyboard exclusion, theme, direction, and | |
| # narrow layout bound to the exact pull-request head. | |
| - name: Run DropdownMenuGroup audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuGroup:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output dropdown-menu-group-a11y-report.json \ | |
| --components DropdownMenuGroup \ | |
| --ready-selector '[role="menu"]' \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/DropdownMenuGroupAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DropdownMenuGroup audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuGroup:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dropdown-menu-group-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| dropdown-menu-group-a11y-report.json | |
| dropdown-menu-group-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DropdownMenuDivider is a hidden compound subcomponent, so the dedicated | |
| # story and sensor lane keep its open-menu semantics, paint, target | |
| # placement, keyboard exclusion, theme, direction, and narrow layout bound | |
| # to the exact pull-request head. | |
| - name: Run DropdownMenuDivider audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuDivider:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output dropdown-menu-divider-a11y-report.json \ | |
| --components DropdownMenuDivider \ | |
| --ready-selector '[role="menu"]' \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/DropdownMenuDividerAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DropdownMenuDivider audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuDivider:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dropdown-menu-divider-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| dropdown-menu-divider-a11y-report.json | |
| dropdown-menu-divider-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DropdownMenuItem owns one interactive pointer-menu row. Its label, icon, | |
| # description, and end content follow logical document direction; the row | |
| # uses logical inline padding and start-aligned text. Parent DropdownMenu | |
| # owns directional placement and keyboard navigation. | |
| - name: Run DropdownMenuItem audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuItem:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output dropdown-menu-item-a11y-report.json \ | |
| --components DropdownMenuItem \ | |
| --ready-selector '[role="menu"]' \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DropdownMenuItem audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuItem:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dropdown-menu-item-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| dropdown-menu-item-a11y-report.json | |
| dropdown-menu-item-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DropdownMenuRadioGroup owns controlled value propagation, the named | |
| # role=group wrapper, close policy, and the tokenized gap between radio | |
| # rows. Parent DropdownMenu owns keyboard navigation; each radio item owns | |
| # menuitemradio semantics and indicator paint. | |
| - name: Run DropdownMenuRadioGroup audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuRadioGroup:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output dropdown-menu-radio-group-a11y-report.json \ | |
| --components DropdownMenuRadioGroup \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/DropdownMenuRadioGroupAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DropdownMenuRadioGroup audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuRadioGroup:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dropdown-menu-radio-group-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| dropdown-menu-radio-group-a11y-report.json | |
| dropdown-menu-radio-group-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DropdownMenuRadioItem owns one menuitemradio row: its checked state, | |
| # decorative radio marker, icon, description, end content, disabled | |
| # paint, and composition of caller handlers with row activation. The | |
| # group owns value propagation; DropdownMenu owns keyboard navigation. | |
| - name: Run DropdownMenuRadioItem audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuRadioItem:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output dropdown-menu-radio-item-a11y-report.json \ | |
| --components DropdownMenuRadioItem \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DropdownMenuRadioItem audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuRadioItem:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dropdown-menu-radio-item-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| dropdown-menu-radio-item-a11y-report.json | |
| dropdown-menu-radio-item-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DropdownMenuSubMenu owns one menuitem row that reveals its own rows: the | |
| # popup state and wiring, the flyout beside the row, the drilled-in view, | |
| # the caret or spinner, and disabled paint. DropdownMenu owns the root | |
| # surface, the drill-in stack, and root keyboard navigation. | |
| - name: Run DropdownMenuSubMenu audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuSubMenu:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output dropdown-menu-submenu-a11y-report.json \ | |
| --components DropdownMenuSubMenu \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DropdownMenu/__tests__/DropdownMenuSubMenuAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DropdownMenuSubMenu audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuSubMenu:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dropdown-menu-submenu-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| dropdown-menu-submenu-a11y-report.json | |
| dropdown-menu-submenu-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # ContextMenu owns pointer and touch presentations across cursor anchoring, | |
| # selectable rows, sections, inline triggers, RTL, and narrow viewports. | |
| # Its audit lane binds the rendered matrix to the exact pull-request head. | |
| - name: Run ContextMenu audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ContextMenu:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output context-menu-a11y-report.json \ | |
| --components ContextMenu \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/ContextMenu/__tests__/ContextMenuAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload ContextMenu audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ContextMenu:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: context-menu-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| context-menu-a11y-report.json | |
| context-menu-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # ContextMenuItem opens from a pointer gesture after the trigger renders. | |
| # The focused selector wait binds axe to the open menu rather than letting | |
| # the trigger's first frame satisfy generic Storybook readiness. | |
| - name: Run ContextMenuItem audit browser evidence | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ContextMenuItem:') | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output context-menu-item-a11y-report.json \ | |
| --components ContextMenuItem \ | |
| --ready-selector '[role="menu"]' \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new | |
| - name: Upload ContextMenuItem audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] ContextMenuItem:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: context-menu-item-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: context-menu-item-a11y-report.json | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # Drawer audit evidence covers modal/non-modal, both logical sides, | |
| # root-owned RTL, purpose, narrow widths, custom theming, padding, and | |
| # sibling stacking. Axe and the sensor matrix both run even if one fails. | |
| - name: Run Drawer audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] Drawer:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output drawer-a11y-report.json \ | |
| --components Drawer \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload Drawer audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] Drawer:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: drawer-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| drawer-a11y-report.json | |
| test-results/drawer-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DrawerHeader audit evidence proves its title row, numeric ReactNode slot | |
| # values, close action, direction, theme, focus, and narrow reflow on the | |
| # exact PR head. Axe and the sensor matrix both run if either one fails. | |
| - name: Run DrawerHeader audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DrawerHeader:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output drawer-header-a11y-report.json \ | |
| --components DrawerHeader \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DrawerHeader audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DrawerHeader:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: drawer-header-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| drawer-header-a11y-report.json | |
| test-results/drawer-header-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # DateInput's open-state audit story uses a play function to open the | |
| # popover. Restricting this focused pass to that story lets the selector | |
| # wait bind axe to the Calendar dialog without making every DateInput story | |
| # require an open overlay. The receipt spec then captures rest, focus, | |
| # busy, disabled, status, and open states across the popover, native, and | |
| # bottom-sheet surfaces, themes, direction, pointers, and viewport. | |
| - name: Run DateInput audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DateInput:') }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output date-input-a11y-report.json \ | |
| --components DateInput \ | |
| --stories core-dateinput--open-calendar-audit \ | |
| --ready-selector '[role="dialog"]' \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/DateInput/__tests__/DateInputAudit.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload DateInput audit evidence | |
| if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DateInput:') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: date-input-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| date-input-a11y-report.json | |
| date-input-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # The CheckboxList and CheckboxListItem component audits grade the same | |
| # option rows: interactive row paint, focus, busy, disabled, read-only, | |
| # status, narrow, forced-colors, and RTL states from exact-head Chromium | |
| # receipts. The shared checkbox contract also runs for its | |
| # CheckboxListItem bindings, with its own output directory so it cannot | |
| # clear the receipts. Each lane runs even when another fails, and the | |
| # step still runs after an earlier audit step fails, so a failing-before | |
| # head banks complete evidence. | |
| - name: Run CheckboxList audit browser evidence | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' && (startsWith(github.event.pull_request.title, '[Component Audit] CheckboxList:') || startsWith(github.event.pull_request.title, '[Component Audit] CheckboxListItem:')) }} | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PLAYWRIGHT_JSON_OUTPUT_NAME: checkbox-list-pattern-results.json | |
| run: | | |
| status=0 | |
| node .github/scripts/accessibility-audit.js \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output checkbox-list-a11y-report.json \ | |
| --components CheckboxList,CheckboxListItem \ | |
| --baseline .github/a11y-baseline.json \ | |
| --fail-on-new || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.chromium.spec.ts \ | |
| --project chromium \ | |
| --grep 'CheckboxListItem \[' \ | |
| --output checkbox-list-pattern-output \ | |
| --reporter=list,json || status=1 | |
| pnpm exec playwright test \ | |
| packages/core/src/CheckboxList/__tests__/CheckboxList.a11y.chromium.spec.ts \ | |
| --project chromium || status=1 | |
| exit "$status" | |
| - name: Upload CheckboxList audit evidence | |
| if: always() && github.event_name == 'pull_request' && (startsWith(github.event.pull_request.title, '[Component Audit] CheckboxList:') || startsWith(github.event.pull_request.title, '[Component Audit] CheckboxListItem:')) | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: checkbox-list-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| path: | | |
| checkbox-list-a11y-report.json | |
| checkbox-list-pattern-results.json | |
| test-results/checkbox-list-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| # Release-only accessibility contracts run beside pr-a11y instead of after | |
| # its full axe sweep, so the release check waits for the longer of the two | |
| # rather than their sum. release-check requires this job as it requires | |
| # pr-a11y. | |
| a11y-contracts-shard: | |
| name: Accessibility spec-test contracts (${{ matrix.shard }}/${{ strategy.job-total }}) | |
| needs: [build-storybook, check-components] | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' && needs.check-components.outputs.has_components == 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3] | |
| # One core per worker: on two cores, four workers starved the CPU-bound | |
| # "every expectation" specs past their timeouts. | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| - name: Install Playwright | |
| run: pnpm install --frozen-lockfile && npx playwright install chromium | |
| # The exhaustive contract/fixture matrix. PRs retain scoped axe | |
| # validation and the fast interaction guards in pr-a11y; they must not | |
| # pay for every component's browser bindings on every change. | |
| - name: Run accessibility spec-test contracts | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' | |
| env: | |
| ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
| A11Y_CONTRACT_WORKERS: 4 | |
| # Files are split by recorded duration (a11y-contract-shard.mjs), not | |
| # Playwright's count-based --shard; every listed file runs in one leg. | |
| run: | | |
| set -euo pipefail | |
| node .github/scripts/a11y-contract-shard.mjs --shard "${{ matrix.shard }}/${{ strategy.job-total }}" > contract-files.txt | |
| mapfile -t FILES < contract-files.txt | |
| # The filters come before the options: `--project` takes every | |
| # value after it, so filters placed after it read as project names. | |
| pnpm exec playwright test "${FILES[@]}" --config playwright.config.ts --project chromium | |
| - name: Upload pressed-state pixel evidence | |
| if: always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pressed-state-evidence-${{ needs.build-storybook.outputs.short_hash }}-${{ matrix.shard }} | |
| path: test-results/pressed-state-evidence/ | |
| # A failing run keeps its evidence here (the join merges only after | |
| # every leg passed, then deletes these copies). | |
| retention-days: 30 | |
| # Only the shard that ran the spec has frames; the join requires them. | |
| if-no-files-found: ignore | |
| # Component-audit browser evidence. A whole-component audit has to show | |
| # the states it graded, and the audit node cannot always run a browser — | |
| # so the frames and their sensor receipts are produced here, bound to the | |
| # same exact head as every other check in this job. | |
| - name: Upload component-audit browser evidence | |
| if: always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: component-audit-evidence-${{ needs.build-storybook.outputs.short_hash }}-${{ matrix.shard }} | |
| path: test-results/chat-layout-audit-evidence/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| # Joins the contract shards for release-check: every shard must pass, and | |
| # each evidence set is rebuilt under its usual artifact name. A set no shard | |
| # produced fails the merge, as the single job's upload used to fail. | |
| a11y-contracts: | |
| name: Accessibility spec-test contracts | |
| needs: [build-storybook, check-components, a11y-contracts-shard] | |
| if: ${{ always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' && needs.check-components.outputs.has_components == 'true' }} | |
| runs-on: ubuntu-slim | |
| permissions: {} | |
| steps: | |
| - name: Require every contract shard | |
| env: | |
| SHARD_RESULT: ${{ needs.a11y-contracts-shard.result }} | |
| run: | | |
| if [ "$SHARD_RESULT" != success ]; then | |
| echo "Accessibility contract shards did not all succeed: $SHARD_RESULT" | |
| exit 1 | |
| fi | |
| - name: Join pressed-state pixel evidence | |
| uses: actions/upload-artifact/merge@v7 | |
| with: | |
| name: pressed-state-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| pattern: pressed-state-evidence-${{ needs.build-storybook.outputs.short_hash }}-* | |
| retention-days: 30 | |
| delete-merged: true | |
| - name: Join component-audit browser evidence | |
| uses: actions/upload-artifact/merge@v7 | |
| with: | |
| name: component-audit-evidence-${{ needs.build-storybook.outputs.short_hash }} | |
| pattern: component-audit-evidence-${{ needs.build-storybook.outputs.short_hash }}-* | |
| retention-days: 30 | |
| delete-merged: true | |
| # Build package test owner. The plugin's production CSS partition is a Build | |
| # integration contract: source inspection cannot prove which declaration | |
| # paints after Vite emits the final bundle. The `test-build` name makes that | |
| # package ownership explicit; the historical `test` join above projects its | |
| # result. Until runtime:build has a specialized route, broad CI dispatches it. | |
| test-build: | |
| needs: [check-scope] | |
| if: github.event_name != 'workflow_dispatch' && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/setup | |
| - name: Verify packed consumer dependency contract | |
| run: pnpm vitest run packages/build/src/packed-consumer.test.mjs --project node --maxWorkers=1 | |
| - name: Install Playwright | |
| run: npx playwright install chromium | |
| # The guard imports the plugin's build artifact, the same one a consumer | |
| # installs. | |
| - name: Build the Vite plugin | |
| run: pnpm -F @astryxdesign/build build | |
| - name: Run Build CSS-layer cascade guard | |
| run: node .github/scripts/theme-layer-cascade.js | |
| # Guest token boundaries cross portals and the host light/dark cascade. This | |
| # requires a production browser render; source and jsdom checks cannot prove | |
| # which custom properties paint the portaled surfaces. | |
| fixture-contrast: | |
| needs: [check-scope] | |
| if: github.event_name != 'workflow_dispatch' && needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true' | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/setup | |
| - name: Install Playwright | |
| run: npx playwright install chromium | |
| - name: Verify canonical setup compositions | |
| env: | |
| ASTRYX_CANONICAL_SETUP_BROWSER: '1' | |
| run: pnpm vitest run internal/vibe-tests/setup-test/setup-canonical.test.ts --project node --maxWorkers=1 | |
| - name: Verify guest fixture contrast | |
| run: pnpm -F @astryxdesign/vibe-tests fixtures:contrast | |
| # The full visual plan first loads every Core story to learn which theming | |
| # targets it renders, and that scout is most of the job's time. It runs here | |
| # as parallel shards over exactly the release plan's story list; pr-visual | |
| # joins them only when every shard succeeded, and otherwise scouts inline. | |
| visual-scout: | |
| name: Stable visual scout (${{ matrix.shard }}/${{ strategy.job-total }}) | |
| needs: [build-storybook, check-components] | |
| if: >- | |
| !cancelled() && | |
| needs.build-storybook.result == 'success' && | |
| needs.check-components.result == 'success' && | |
| ((github.event_name == 'pull_request' && | |
| needs.check-components.outputs.has_stable_visual == 'true' && | |
| needs.check-components.outputs.broad_stable_visual == 'true') || | |
| (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) | |
| # Five legs: at three, each leg's scout took ~4.5 minutes and the visual | |
| # regression waited for the slowest one. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4, 5] | |
| # Four pages on four cores: the scout is page-load bound, and on the rig | |
| # this cut a shard's scout by a quarter against two pages on two cores. | |
| runs-on: 4-core-ubuntu | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| # The artifact carries the themes and the Core dist they import, built | |
| # at this commit. If it is missing, the gate builds Core and the themes. | |
| - name: Download built themes and core | |
| continue-on-error: true | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dists-${{ needs.build-storybook.outputs.short_hash }} | |
| path: packages | |
| - name: Install Playwright | |
| run: pnpm install --frozen-lockfile && npx playwright install chromium | |
| - name: Scout this shard of the release plan | |
| run: | | |
| node .github/scripts/visual-gate/gate.mjs scout \ | |
| --storybook-dir apps/storybook/dist \ | |
| --baseline .github/visual-baseline \ | |
| --shard "${{ matrix.shard }}/${{ strategy.job-total }}" \ | |
| --concurrency 4 \ | |
| --observations-out ".visual-scout/observations-${{ matrix.shard }}.json" | |
| - name: Upload scout shard | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: visual-scout-${{ needs.build-storybook.outputs.short_hash }}-${{ matrix.shard }} | |
| path: .visual-scout/observations-${{ matrix.shard }}.json | |
| retention-days: 1 | |
| if-no-files-found: error | |
| # Stable-package visual regression and explicit baseline capture share this | |
| # owner. Focused PRs compare the checked-in baseline; broad PRs use the full | |
| # canonical plan. Maintenance captures candidates on the same runner, and a | |
| # normal reviewed pull request updates the versioned baseline. | |
| # Audit and interaction fixtures stay with their existing browser checks. | |
| pr-visual: | |
| name: Stable visual regression | |
| needs: | |
| [build-storybook, check-components, maintenance-request, visual-scout] | |
| if: >- | |
| !cancelled() && | |
| ((github.event_name == 'pull_request' && | |
| needs.build-storybook.result == 'success' && | |
| needs.check-components.result == 'success' && | |
| needs.check-components.outputs.has_stable_visual == 'true') || | |
| (github.event_name == 'workflow_dispatch' && | |
| ((inputs.operation == 'release-check' && | |
| needs.build-storybook.result == 'success' && | |
| needs.check-components.result == 'success') || | |
| (needs.maintenance-request.result == 'success' && inputs.operation == 'capture')))) | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Download analysis artifact | |
| if: github.event_name == 'pull_request' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: pr-analysis | |
| - name: Download Storybook artifact | |
| if: github.event_name == 'pull_request' || inputs.operation == 'release-check' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| # The artifact carries the themes and the Core dist they import, built | |
| # at this commit. If it is missing, the gate builds Core and the themes. | |
| - name: Download built themes and core | |
| if: github.event_name == 'pull_request' || inputs.operation == 'release-check' | |
| continue-on-error: true | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dists-${{ needs.build-storybook.outputs.short_hash }} | |
| path: packages | |
| # Only a complete set: the gate refuses a partial or mismatched one, and | |
| # without any it scouts inline as before. | |
| - name: Download scout shards | |
| if: (github.event_name == 'pull_request' || inputs.operation == 'release-check') && needs.visual-scout.result == 'success' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: visual-scout-${{ needs.build-storybook.outputs.short_hash }}-* | |
| path: .visual-scout | |
| merge-multiple: true | |
| - name: Install Playwright | |
| run: pnpm install --frozen-lockfile && npx playwright install chromium | |
| - name: Build canonical maintenance Storybook | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'capture' | |
| run: pnpm build && pnpm -F @astryxdesign/storybook build | |
| # The reviewed baseline is versioned with the code so CI never depends on | |
| # mutable website storage. Baseline refreshes remain separate reviewable PRs. | |
| - name: Run the visual gate for the touched components | |
| id: visual | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BROAD_STABLE_VISUAL: ${{ needs.check-components.outputs.broad_stable_visual }} | |
| ASTRYX_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| ASTRYX_PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| run: | | |
| set -eu | |
| # Component names are not globally unique; use their package identity. | |
| COMPONENTS=$(jq -r '. as $root | [(.newComponents + .modifiedComponents)[] | select($root.componentStats[.].package == "@astryxdesign/core")] | unique | join(",")' analysis.json) | |
| THEMES=$(jq -r '(.changedStableThemes // []) | join(",")' analysis.json) | |
| COMMAND=check | |
| if [ "$BROAD_STABLE_VISUAL" = 'true' ]; then | |
| COMMAND=release | |
| SCOPE_ARGS=() | |
| elif [ -n "$COMPONENTS" ] && [ -n "$THEMES" ]; then | |
| SCOPE_ARGS=(--tiers 'component,theme-matrix' --components "$COMPONENTS" --themes "$THEMES") | |
| elif [ -n "$COMPONENTS" ]; then | |
| SCOPE_ARGS=(--tiers component --components "$COMPONENTS" --no-scout) | |
| elif [ -n "$THEMES" ]; then | |
| SCOPE_ARGS=(--tiers theme-matrix --themes "$THEMES") | |
| else | |
| # Broad changes stay with this owner: the canonical full plan has | |
| # no focused-component review ceiling and no deferred backup gate. | |
| COMMAND=release | |
| SCOPE_ARGS=() | |
| fi | |
| echo "Stable Core components: ${COMPONENTS:-none}" | |
| echo "Stable themes: ${THEMES:-none}" | |
| OBS_ARGS=() | |
| if [ -d .visual-scout ]; then OBS_ARGS=(--observation-shards .visual-scout); fi | |
| set +e | |
| node .github/scripts/visual-gate/gate.mjs "$COMMAND" \ | |
| --storybook-dir apps/storybook/dist \ | |
| --baseline .github/visual-baseline \ | |
| --out .visual-run \ | |
| "${SCOPE_ARGS[@]}" \ | |
| "${OBS_ARGS[@]}" \ | |
| --summary-output visual-summary.md | |
| code=$? | |
| set -e | |
| # Exit 2 is a visual change for review; every other nonzero exit is | |
| # an infrastructure failure, not a successful evidence receipt. | |
| case "$code" in 0|2) ;; *) exit "$code" ;; esac | |
| STATUS=$(jq -er '.status' .visual-run/verdict.json) | |
| if [ "$STATUS" = 'skipped' ]; then | |
| # The focused budget refused before capture. The same owner now | |
| # captures its bounded canonical full plan rather than leaving a gap. | |
| set +e | |
| node .github/scripts/visual-gate/gate.mjs release \ | |
| --storybook-dir apps/storybook/dist \ | |
| --baseline .github/visual-baseline \ | |
| --out .visual-run \ | |
| "${OBS_ARGS[@]}" \ | |
| --summary-output visual-summary.md | |
| code=$? | |
| set -e | |
| case "$code" in 0|2) ;; *) exit "$code" ;; esac | |
| STATUS=$(jq -er '.status' .visual-run/verdict.json) | |
| fi | |
| [ -f visual-summary.md ] && cat visual-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| case "$STATUS" in | |
| pass|changed) ;; | |
| *) echo "Visual evidence is incomplete: $STATUS"; exit 1 ;; | |
| esac | |
| - name: Upload visual verdict and report | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: visual-pr-report | |
| path: | | |
| .visual-run/verdict.json | |
| .visual-run/manifest.json | |
| .visual-run/shots/ | |
| .visual-run/report/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| - name: Run full release visual check | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' | |
| run: | | |
| set -eu | |
| OBS_ARGS=() | |
| if [ -d .visual-scout ]; then OBS_ARGS=(--observation-shards .visual-scout); fi | |
| set +e | |
| node .github/scripts/visual-gate/gate.mjs release \ | |
| --storybook-dir apps/storybook/dist \ | |
| --baseline .github/visual-baseline \ | |
| --out .visual-run \ | |
| "${OBS_ARGS[@]}" \ | |
| --summary-output visual-summary.md | |
| code=$? | |
| set -e | |
| case "$code" in 0|2) ;; *) exit "$code" ;; esac | |
| STATUS=$(jq -er '.status' .visual-run/verdict.json) | |
| case "$STATUS" in | |
| pass|changed) ;; | |
| *) echo "Visual evidence is incomplete: $STATUS"; exit 1 ;; | |
| esac | |
| cat visual-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload release visual verdict and report | |
| if: always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: visual-release-report | |
| path: | | |
| .visual-run/verdict.json | |
| .visual-run/manifest.json | |
| .visual-run/shots/ | |
| .visual-run/report/ | |
| retention-days: 14 | |
| if-no-files-found: error | |
| - name: Capture canonical visual baseline | |
| id: maintenance-capture | |
| if: github.event_name == 'workflow_dispatch' && inputs.operation == 'capture' | |
| # A complete browser-refresh capture can be incomparable with the old | |
| # baseline. The next step requires full capture, not a clean comparison. | |
| continue-on-error: true | |
| run: | | |
| node .github/scripts/visual-gate/gate.mjs release \ | |
| --storybook-dir apps/storybook/dist \ | |
| --baseline .github/visual-baseline \ | |
| --out .visual-run \ | |
| --summary-output visual-summary.md | |
| - name: Validate canonical baseline capture | |
| id: maintenance-validation | |
| if: >- | |
| always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'capture' && | |
| steps.maintenance-capture.outcome != 'skipped' | |
| env: | |
| CAPTURE_SHA: ${{ github.sha }} | |
| CAPTURE_RUN_ID: ${{ github.run_id }} | |
| CAPTURE_RUN_ATTEMPT: ${{ github.run_attempt }} | |
| run: | | |
| node --input-type=module - <<'NODE' | |
| import fs from 'node:fs'; | |
| import {validateVisualMaintenanceCapture} from './.github/scripts/visual-maintenance-source.mjs'; | |
| validateVisualMaintenanceCapture({ | |
| manifest: JSON.parse(fs.readFileSync('.visual-run/manifest.json', 'utf8')), | |
| verdict: JSON.parse(fs.readFileSync('.visual-run/verdict.json', 'utf8')), | |
| sha: process.env.CAPTURE_SHA, | |
| runId: process.env.CAPTURE_RUN_ID, | |
| runAttempt: process.env.CAPTURE_RUN_ATTEMPT, | |
| }); | |
| NODE | |
| cat visual-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload canonical baseline candidate | |
| if: always() && steps.maintenance-validation.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: visual-baseline-capture-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: | | |
| .visual-run/shots/ | |
| .visual-run/manifest.json | |
| .visual-run/verdict.json | |
| .visual-run/report/ | |
| retention-days: 14 | |
| if-no-files-found: error | |
| # RTL semantic audit. Sibling to pr-a11y: same build-storybook artifact, same | |
| # analysis.json scoping, so ordinary PRs only pay for the components they | |
| # touched. A harness-only PR runs the fixed Chart/ChartLegend smoke scope so | |
| # routing and target changes prove themselves instead of skipping their own | |
| # check. A policy-sensitive full run spans ~2,000 stories and exceeded the | |
| # single-job budget, so CI partitions it by canonical package; each shard runs | |
| # eight browser pages on its four cores (the audit waits on page loads), and | |
| # the stable pr-rtl join requires all five scope manifests plus a report from | |
| # every applicable package. | |
| # The scheduled full sweep also runs in rtl-weekly.yml. | |
| # | |
| # Three auto dimensions: D1 icon-mirror, D5 positional-mirror, and D6 | |
| # contextual directional decorations. Curated D2/D3/D4/D7/D8/D9 add | |
| # behavior and geometry that need selectors. The applicability rollup treats unexplained all-N/A as a | |
| # coverage gap for both new and existing components. | |
| # | |
| # Audit findings remain SOFT while the stability window is observed: the audit | |
| # step may fail after writing a report. Missing/canceled/incomplete shards are | |
| # HARD failures, and the pr-rtl join cannot pass without every package scope | |
| # manifest and every applicable report. | |
| # To promote findings too, remove the audit step's continue-on-error. | |
| pr-rtl-shard: | |
| name: pr-rtl (${{ matrix.package }}${{ matrix.parts > 1 && format(' {0}/{1}', matrix.part, matrix.parts) || '' }}) | |
| needs: [build-storybook, check-components] | |
| if: >- | |
| (github.event_name == 'pull_request' || | |
| (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) && | |
| (needs.check-components.outputs.has_rtl_components == 'true' || | |
| needs.check-components.outputs.has_rtl_harness == 'true' || | |
| needs.check-components.outputs.force_full_component_audits == 'true') | |
| # Core is the largest package, so its audit is split three ways | |
| # (`--shard`) and joined by pr-rtl-merge; every other package runs whole. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {package: core, part: 1, parts: 3} | |
| - {package: core, part: 2, parts: 3} | |
| - {package: core, part: 3, parts: 3} | |
| - {package: lab, part: 1, parts: 1} | |
| - {package: charts, part: 1, parts: 1} | |
| - {package: richtext, part: 1, parts: 1} | |
| - {package: vega, part: 1, parts: 1} | |
| runs-on: 4-core-ubuntu | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Verify RTL checkout | |
| if: github.event_name == 'pull_request' | |
| env: | |
| EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD_SHA" | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| with: | |
| install: 'false' | |
| - name: Download analysis artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: pr-analysis | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| - name: Install Playwright | |
| run: pnpm install --frozen-lockfile && npx playwright install chromium | |
| # A registry/classifier mutation runs the full audit from the PR checkout, | |
| # while eligibility itself came from trusted base policy. Scope resolution | |
| # is strict: malformed or missing analysis fails before the soft findings | |
| # step can run. An ordinary harness-only change uses the bounded routing | |
| # smoke scope. | |
| - name: Resolve RTL shard scope | |
| id: rtl-scope | |
| run: | | |
| node .github/scripts/rtl-shard-scope.mjs \ | |
| --analysis analysis.json \ | |
| --package "${{ matrix.package }}" \ | |
| --force-full "${{ needs.check-components.outputs.force_full_component_audits }}" \ | |
| --has-components "${{ needs.check-components.outputs.has_rtl_components }}" \ | |
| --has-harness "${{ needs.check-components.outputs.has_rtl_harness }}" \ | |
| --manifest rtl-shard-scope.json \ | |
| --github-output "$GITHUB_OUTPUT" | |
| - name: Run RTL audit | |
| id: rtl | |
| if: steps.rtl-scope.outputs.should_run == 'true' | |
| continue-on-error: true | |
| run: | | |
| PACKAGE=${{ matrix.package }} | |
| COMPONENTS="${{ steps.rtl-scope.outputs.components }}" | |
| FILTER="${{ steps.rtl-scope.outputs.filter }}" | |
| FILTER_ARGS=() | |
| if [ -n "$FILTER" ]; then | |
| FILTER_ARGS=(--filter "$FILTER") | |
| fi | |
| SHARD_ARGS=() | |
| if [ "${{ matrix.parts }}" -gt 1 ]; then | |
| SHARD_ARGS=(--shard "${{ matrix.part }}/${{ matrix.parts }}" --shard-output "rtl-shard-${{ matrix.part }}.json") | |
| fi | |
| echo "Auditing $PACKAGE components: $COMPONENTS" | |
| node apps/storybook/rtl-audit/rtl-audit.mjs \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output rtl-audit-report.json \ | |
| --packages "$PACKAGE" \ | |
| "${SHARD_ARGS[@]}" \ | |
| --concurrency 8 \ | |
| "${FILTER_ARGS[@]}" | |
| - name: Require completed RTL shard report | |
| if: always() | |
| run: | | |
| SCOPE_OUTCOME="${{ steps.rtl-scope.outcome }}" | |
| SHOULD_RUN="${{ steps.rtl-scope.outputs.should_run }}" | |
| AUDIT_OUTCOME="${{ steps.rtl.outcome }}" | |
| if [ "$SCOPE_OUTCOME" != "success" ]; then | |
| echo "RTL shard scope did not resolve successfully: $SCOPE_OUTCOME" | |
| exit 1 | |
| fi | |
| if [ "$SHOULD_RUN" = "true" ]; then | |
| if [ "$AUDIT_OUTCOME" != "success" ] && [ "$AUDIT_OUTCOME" != "failure" ]; then | |
| echo "Applicable RTL audit did not run: $AUDIT_OUTCOME" | |
| exit 1 | |
| fi | |
| if [ "${{ matrix.parts }}" -gt 1 ]; then | |
| # A part writes cards only; pr-rtl-merge checks the joined report. | |
| test -s "rtl-shard-${{ matrix.part }}.json" | |
| else | |
| node .github/scripts/rtl-report-completion.mjs \ | |
| --report rtl-audit-report.json \ | |
| --package "${{ matrix.package }}" \ | |
| --filter "${{ steps.rtl-scope.outputs.filter }}" | |
| fi | |
| elif [ "$SHOULD_RUN" = "false" ]; then | |
| if [ "$AUDIT_OUTCOME" != "skipped" ]; then | |
| echo "Out-of-scope RTL audit unexpectedly ran: $AUDIT_OUTCOME" | |
| exit 1 | |
| fi | |
| else | |
| echo "RTL shard scope produced no explicit should_run decision." | |
| exit 1 | |
| fi | |
| - name: Write scorecard summary | |
| if: always() && steps.rtl-scope.outputs.should_run == 'true' && matrix.parts == 1 | |
| run: | | |
| node .github/scripts/rtl-scorecard-summary.mjs \ | |
| --report rtl-audit-report.json \ | |
| --scope "${{ steps.rtl-scope.outputs.components }}" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload RTL shard evidence | |
| if: always() && matrix.parts == 1 | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rtl-audit-report-${{ matrix.package }} | |
| path: | | |
| rtl-shard-scope.json | |
| rtl-audit-report.json | |
| if-no-files-found: error | |
| retention-days: 1 | |
| - name: Upload RTL part | |
| if: always() && matrix.parts > 1 | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rtl-audit-part-${{ matrix.package }}-${{ matrix.part }} | |
| path: | | |
| rtl-shard-scope.json | |
| rtl-shard-${{ matrix.part }}.json | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # Joins the Core parts into the one report a whole Core leg would have | |
| # written (the same scope manifest, report and completion check), uploaded | |
| # under the same artifact name for the pr-rtl join. A missing or mismatched | |
| # part fails here. | |
| pr-rtl-merge: | |
| name: pr-rtl (core) | |
| needs: [build-storybook, check-components, pr-rtl-shard] | |
| if: >- | |
| always() && !cancelled() && | |
| (github.event_name == 'pull_request' || | |
| (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) && | |
| (needs.check-components.outputs.has_rtl_components == 'true' || | |
| needs.check-components.outputs.has_rtl_harness == 'true' || | |
| needs.check-components.outputs.force_full_component_audits == 'true') | |
| runs-on: 2-core-ubuntu-arm | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node and pnpm | |
| uses: ./.github/actions/setup | |
| - name: Download Storybook artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: storybook-${{ needs.build-storybook.outputs.short_hash }} | |
| path: apps/storybook/dist | |
| - name: Download Core RTL parts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: rtl-audit-part-core-* | |
| path: rtl-parts | |
| - name: Join Core RTL parts | |
| id: join | |
| run: | | |
| set -eu | |
| manifests=(rtl-parts/*/rtl-shard-scope.json) | |
| if [ "${#manifests[@]}" -ne 3 ]; then | |
| echo "Expected 3 Core RTL parts, found ${#manifests[@]}." | |
| exit 1 | |
| fi | |
| for manifest in "${manifests[@]}"; do | |
| cmp -s "$manifest" "${manifests[0]}" || { echo "Core RTL parts disagree on scope: $manifest"; exit 1; } | |
| done | |
| cp "${manifests[0]}" rtl-shard-scope.json | |
| FILTER=$(jq -r '.filter' rtl-shard-scope.json) | |
| echo "components=${FILTER:-full core roster}" >> "$GITHUB_OUTPUT" | |
| if [ "$(jq -r '.shouldRun' rtl-shard-scope.json)" != true ]; then | |
| echo "Core RTL audit not applicable." | |
| exit 0 | |
| fi | |
| FILTER_ARGS=() | |
| if [ -n "$FILTER" ]; then FILTER_ARGS=(--filter "$FILTER"); fi | |
| set +e | |
| node apps/storybook/rtl-audit/rtl-audit.mjs \ | |
| --storybook-dir apps/storybook/dist \ | |
| --output rtl-audit-report.json \ | |
| --packages core \ | |
| --merge-shards rtl-parts \ | |
| "${FILTER_ARGS[@]}" | |
| code=$? | |
| set -e | |
| # 1 is the soft findings signal; anything else is a failed join. | |
| case "$code" in 0|1) ;; *) exit "$code" ;; esac | |
| node .github/scripts/rtl-report-completion.mjs \ | |
| --report rtl-audit-report.json \ | |
| --package core \ | |
| --filter "$FILTER" | |
| - name: Write scorecard summary | |
| if: always() && hashFiles('rtl-audit-report.json') != '' | |
| run: | | |
| node .github/scripts/rtl-scorecard-summary.mjs \ | |
| --report rtl-audit-report.json \ | |
| --scope "${{ steps.join.outputs.components }}" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload RTL shard evidence | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rtl-audit-report-core | |
| path: | | |
| rtl-shard-scope.json | |
| rtl-audit-report.json | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # Stable required context joining the five package shards above. | |
| pr-rtl: | |
| needs: [check-scope, check-components, pr-rtl-shard, pr-rtl-merge] | |
| if: ${{ always() && !cancelled() && ((github.event_name == 'pull_request' && needs.check-scope.outputs.spec_only != 'true') || (github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check')) }} | |
| runs-on: ubuntu-slim | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Download applicable RTL shard reports | |
| if: ${{ needs.check-components.result == 'success' && (needs.check-components.outputs.has_rtl_components == 'true' || needs.check-components.outputs.has_rtl_harness == 'true' || needs.check-components.outputs.force_full_component_audits == 'true') }} | |
| continue-on-error: true | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: rtl-audit-report-* | |
| path: rtl-shard-reports | |
| - name: Require every applicable RTL shard | |
| if: always() | |
| run: | | |
| node .github/scripts/rtl-join.mjs \ | |
| --check-components "${{ needs.check-components.result }}" \ | |
| --shards "${{ needs.pr-rtl-shard.result == needs.pr-rtl-merge.result && needs.pr-rtl-shard.result || format('{0}/{1}', needs.pr-rtl-shard.result, needs.pr-rtl-merge.result) }}" \ | |
| --should-run "${{ needs.check-components.outputs.has_rtl_components == 'true' || needs.check-components.outputs.has_rtl_harness == 'true' || needs.check-components.outputs.force_full_component_audits == 'true' }}" \ | |
| --force-full "${{ needs.check-components.outputs.force_full_component_audits }}" \ | |
| --reports-dir rtl-shard-reports | |
| # Release-time projection only: the existing owners above do all measurement. | |
| # A skipped owner or main drift must never look like passing release evidence. | |
| release-check: | |
| needs: | |
| [ | |
| check-scope, | |
| check-components, | |
| build-storybook, | |
| typecheck, | |
| pr-visual, | |
| pr-a11y, | |
| a11y-contracts, | |
| pr-a11y-audit, | |
| pr-rtl, | |
| ] | |
| if: ${{ always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' }} | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Require complete exact-head canonical checks | |
| uses: actions/github-script@v9 | |
| env: | |
| RELEASE_NEEDS: ${{ toJSON(needs) }} | |
| RELEASE_BRANCH: ${{ inputs['release-branch'] }} | |
| EXPECTED_HEAD: ${{ inputs['expected-head'] }} | |
| CHECKED_HEAD: ${{ needs.check-scope.outputs.release_head }} | |
| PLAN_DIGEST: ${{ needs.check-scope.outputs.release_plan_digest }} | |
| with: | |
| script: | | |
| const needs = JSON.parse(process.env.RELEASE_NEEDS); | |
| for (const name of ['check-scope', 'check-components', 'build-storybook', 'typecheck', 'pr-visual', 'pr-a11y', 'a11y-contracts', 'pr-a11y-audit', 'pr-rtl']) { | |
| if (needs[name]?.result !== 'success') { | |
| throw new Error(`Required release job ${name} did not succeed: ${needs[name]?.result}`); | |
| } | |
| } | |
| const branch = process.env.RELEASE_BRANCH; | |
| const expectedHead = process.env.EXPECTED_HEAD; | |
| if (context.ref !== `refs/heads/${branch}`) { | |
| throw new Error('Canonical release checks must run from the requested branch.'); | |
| } | |
| if (context.sha !== expectedHead) { | |
| throw new Error('Checked-out commit does not match expected head.'); | |
| } | |
| const {data} = await github.rest.git.getRef({...context.repo, ref: `heads/${branch}`}); | |
| if (branch === 'main') { | |
| if (process.env.CHECKED_HEAD !== expectedHead) { | |
| throw new Error('Main authority check did not bind the expected head.'); | |
| } | |
| const comparison = await github.rest.repos.compareCommitsWithBasehead({ | |
| ...context.repo, | |
| basehead: `${expectedHead}...${data.object.sha}`, | |
| }); | |
| if (!['identical', 'ahead'].includes(comparison.data.status)) { | |
| throw new Error('Checked main commit is not an ancestor of current main.'); | |
| } | |
| await core.summary | |
| .addHeading('Main pre-cut checks complete') | |
| .addRaw(`Exact head: ${expectedHead}\n\n`) | |
| .addRaw('Canonical visual, accessibility, and RTL checks completed with full scope. This exact checked commit may be used as the cut SHA while it remains in current main history; later main commits are next-release input.') | |
| .write(); | |
| return; | |
| } | |
| if (data.object.sha !== expectedHead) { | |
| throw new Error(`${branch} moved during checks; dispatch release-check again for its new head.`); | |
| } | |
| if (!branch.startsWith('release/v')) { | |
| throw new Error('Post-bump release checks require a marked release branch.'); | |
| } | |
| if (!/^[0-9a-f]{64}$/.test(process.env.PLAN_DIGEST)) { | |
| throw new Error('Post-bump release checks require the active plan digest.'); | |
| } | |
| await core.summary | |
| .addHeading('Release checks complete') | |
| .addRaw(`Branch: ${branch}\n\n`) | |
| .addRaw(`Exact head: ${expectedHead}\n\n`) | |
| .addRaw(`Plan digest: ${process.env.PLAN_DIGEST}\n\n`) | |
| .addRaw('Canonical visual, accessibility, and RTL checks completed with full scope. Main movement is not release input. This receipt is reusable only for this exact branch, head, and plan digest; any branch revision requires a new run.') | |
| .write(); |