Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

ci: run release a11y contracts beside the axe audit (#7407)

Cindy Zhang25c0653b7067
diff --git a/.github/scripts/ci-test-routing.test.mjs b/.github/scripts/ci-test-routing.test.mjs
index 5cf94e4a37..06349b1352 100644
--- a/.github/scripts/ci-test-routing.test.mjs
+++ b/.github/scripts/ci-test-routing.test.mjs
@@ -231,7 +231,12 @@ describe('ci.yml RTL package sharding', () => {
it('binds component evidence source, Storybook bytes, and RTL code to the PR head', () => {
const exactRef = '${{ github.event.pull_request.head.sha || github.sha }}';
- for (const name of ['build-storybook', 'pr-a11y', 'pr-rtl-shard']) {
+ for (const name of [
+ 'build-storybook',
+ 'pr-a11y',
+ 'a11y-contracts',
+ 'pr-rtl-shard',
+ ]) {
const checkout = workflow.jobs[name].steps.find(candidate =>
candidate.uses?.startsWith('actions/checkout@'),
);
diff --git a/.github/scripts/release-check-workflow.test.mjs b/.github/scripts/release-check-workflow.test.mjs
index ce8ec009d5..8a1e63b190 100644
--- a/.github/scripts/release-check-workflow.test.mjs
+++ b/.github/scripts/release-check-workflow.test.mjs
@@ -26,6 +26,7 @@ const releaseJobs = [
'typecheck',
'pr-visual',
'pr-a11y',
+ 'a11y-contracts',
'pr-rtl-shard',
'pr-rtl',
'release-check',
@@ -219,7 +220,7 @@ describe('explicit release routing', () => {
},
);
- it.each(['pr-a11y', 'pr-visual', 'pr-rtl-shard'])(
+ it.each(['pr-a11y', 'a11y-contracts', 'pr-visual', 'pr-rtl-shard'])(
'blocks %s when its build fails',
name => {
const needs = dependencies(jobs[name]);
@@ -366,6 +367,7 @@ describe('exact main and release branch completion', () => {
'typecheck',
'pr-visual',
'pr-a11y',
+ 'a11y-contracts',
'pr-rtl',
]);
});
@@ -582,7 +584,7 @@ describe('full release scope without PR metadata or maintenance writes', () => {
expect(result.stdout).not.toContain('--components');
expect(audit['continue-on-error']).toBeUndefined();
expect(
- step('pr-a11y', 'Run accessibility spec-test contracts').env
+ step('a11y-contracts', 'Run accessibility spec-test contracts').env
.ASTRYX_HEAD_SHA,
).toBe('${{ github.event.pull_request.head.sha || github.sha }}');
});
@@ -648,27 +650,29 @@ describe('full release scope without PR metadata or maintenance writes', () => {
});
it('keeps exhaustive a11y contracts, their artifacts, and Probe reach release-only', () => {
- for (const name of [
- 'Run accessibility spec-test contracts',
- 'Upload pressed-state pixel evidence',
- 'Upload component-audit browser evidence',
- 'Check Probe theme reach',
- 'Upload Probe reach report',
+ for (const [job, name] of [
+ ['a11y-contracts', 'Run accessibility spec-test contracts'],
+ ['a11y-contracts', 'Upload pressed-state pixel evidence'],
+ ['a11y-contracts', 'Upload component-audit browser evidence'],
+ ['pr-a11y', 'Check Probe theme reach'],
+ ['pr-a11y', 'Upload Probe reach report'],
]) {
- expect(runs(step('pr-a11y', name)), name).toBe(true);
+ expect(runs(step(job, name)), name).toBe(true);
expect(
- runs(step('pr-a11y', name), {event: 'pull_request', operation: ''}),
+ runs(step(job, name), {event: 'pull_request', operation: ''}),
name,
).toBe(false);
- expect(runs(step('pr-a11y', name), {operation: 'capture'}), name).toBe(
- false,
- );
+ expect(runs(step(job, name), {operation: 'capture'}), name).toBe(false);
}
- expect(step('pr-a11y', 'Run accessibility spec-test contracts').run).toBe(
- 'pnpm test:a11y-contract',
- );
+ expect(runs(jobs['a11y-contracts'])).toBe(true);
+ expect(
+ runs(jobs['a11y-contracts'], {event: 'pull_request', operation: ''}),
+ ).toBe(false);
+ expect(
+ step('a11y-contracts', 'Run accessibility spec-test contracts').run,
+ ).toBe('pnpm test:a11y-contract');
expect(
- step('pr-a11y', 'Run accessibility spec-test contracts')[
+ step('a11y-contracts', 'Run accessibility spec-test contracts')[
'continue-on-error'
],
).toBeUndefined();
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6cc935752e..784772e099 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1816,9 +1816,59 @@ jobs:
retention-days: 30
if-no-files-found: error
- # Run the exhaustive contract/fixture matrix at release time. PRs retain
- # scoped axe validation and the fast interaction guards above; they must
- # not pay for every component's browser bindings on every change.
+ # Baseline-free target/axis diagnostics are not a visual-regression lane.
+ # Keep their existing report-only behavior with the other browser guards.
+ - name: Check Probe theme reach
+ if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check'
+ continue-on-error: true
+ run: |
+ node .github/scripts/visual-gate/gate.mjs reach \
+ --storybook-dir apps/storybook/dist \
+ --out .visual-reach
+
+ - name: Upload Probe reach report
+ if: always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check'
+ uses: actions/upload-artifact@v7
+ with:
+ name: visual-reach
+ path: .visual-reach/reach.json
+ retention-days: 30
+ if-no-files-found: warn
+
+ # 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:
+ name: Accessibility spec-test contracts
+ needs: [build-storybook, check-components]
+ if: 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: 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:
@@ -1847,25 +1897,6 @@ jobs:
retention-days: 30
if-no-files-found: error
- # Baseline-free target/axis diagnostics are not a visual-regression lane.
- # Keep their existing report-only behavior with the other browser guards.
- - name: Check Probe theme reach
- if: github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check'
- continue-on-error: true
- run: |
- node .github/scripts/visual-gate/gate.mjs reach \
- --storybook-dir apps/storybook/dist \
- --out .visual-reach
-
- - name: Upload Probe reach report
- if: always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check'
- uses: actions/upload-artifact@v7
- with:
- name: visual-reach
- path: .visual-reach/reach.json
- retention-days: 30
- if-no-files-found: warn
-
# 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
@@ -2435,6 +2466,7 @@ jobs:
typecheck,
pr-visual,
pr-a11y,
+ a11y-contracts,
pr-rtl,
]
if: ${{ always() && github.event_name == 'workflow_dispatch' && inputs.operation == 'release-check' }}
@@ -2453,7 +2485,7 @@ jobs:
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', 'pr-rtl']) {
+ for (const name of ['check-scope', 'check-components', 'build-storybook', 'typecheck', 'pr-visual', 'pr-a11y', 'a11y-contracts', 'pr-rtl']) {
if (needs[name]?.result !== 'success') {
throw new Error(`Required release job ${name} did not succeed: ${needs[name]?.result}`);
}