Skip to content

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

TypeScript

ci: each accessibility leg downloads the Storybook before it counts (#10453)

Cindy Zhang6c7a0b31e38c
diff --git a/.github/scripts/a11y-pr-contracts.mjs b/.github/scripts/a11y-pr-contracts.mjs
index 345101f468..89f131b526 100644
--- a/.github/scripts/a11y-pr-contracts.mjs
+++ b/.github/scripts/a11y-pr-contracts.mjs
@@ -1159,7 +1159,9 @@ function main() {
})();
const notRun = budgeted.notRun;
// The opt-in run splits into legs by recorded time. The count step plans
- // them before the Storybook download and the Chromium install; each leg
+ // them after the Storybook download, whose story index a changed
+ // multi-component folder's components resolve through, and before the
+ // Chromium install; each leg
// then runs only its share.
const scopeKnown = changedPaths != null;
// Every leg counts on its own runner. A leg that cannot tell this pull
diff --git a/.github/scripts/a11y-pr-legs.test.mjs b/.github/scripts/a11y-pr-legs.test.mjs
index a827ef9ae3..c8d95db52d 100644
--- a/.github/scripts/a11y-pr-legs.test.mjs
+++ b/.github/scripts/a11y-pr-legs.test.mjs
@@ -8,7 +8,9 @@
* only stretch each file. The job instead splits the selection into up to
* three legs by recorded time, each about ten minutes or less, inside the
* job's fifteen minutes. A leg the selection does not need stops after its
- * count step, before the Storybook download and the Chromium install.
+ * count step, after the Storybook download (a changed multi-component folder
+ * resolves its components through its story index) and before the Chromium
+ * install.
*/
import {spawnSync} from 'node:child_process';
@@ -96,12 +98,17 @@ describe('the browser-specs job', () => {
);
});
- it('counts the legs before the Storybook download and the Chromium install, and only a leg with a share runs its share', () => {
+ it('counts the legs after the Storybook download and before the Chromium install, and only a leg with a share runs its share', () => {
const names = job.steps.map(s => s.name);
const count = step("Count this run's accessibility legs");
- expect(names.indexOf(count.name)).toBeLessThan(
- names.indexOf('Download Storybook artifact'),
+ // A pull request that changes a multi-component folder resolves its
+ // components through the built Storybook's story index, so every leg
+ // downloads it before counting.
+ const download = step('Download Storybook artifact');
+ expect(names.indexOf(download.name)).toBeLessThan(
+ names.indexOf(count.name),
);
+ expect(download.if).toBe(count.if);
expect(names.indexOf(count.name)).toBeLessThan(
names.indexOf('Install Playwright'),
);
@@ -114,7 +121,6 @@ describe('the browser-specs job', () => {
);
expect(count.run).toContain('BASE_SHA=$(git rev-parse "$WORKFLOW_SHA^1")');
for (const name of [
- 'Download Storybook artifact',
'Install Playwright',
'Run browser accessibility specs',
'Upload browser accessibility evidence',
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a161db9ee0..462ad7f0cf 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2301,10 +2301,20 @@ jobs:
with:
name: pr-analysis
+ # Before the count: a pull request that changes a multi-component folder
+ # (Chat, Layer, Chart and the like) resolves its components through the
+ # built Storybook's story index.
+ - name: Download Storybook artifact
+ if: steps.scope.outputs.has_components == 'true'
+ uses: actions/download-artifact@v8
+ with:
+ name: storybook-${{ needs.build-storybook.outputs.short_hash }}
+ path: apps/storybook/dist
+
# How many legs the selection needs, from the specs' recorded times, and
# this leg's share, which the run step reads. It runs before the
- # Storybook download and the Chromium install; listing the specs installs
- # the workspace's dependencies. The runner, its routing lines and the
+ # Chromium install; listing the specs installs the workspace's
+ # dependencies. The runner, its routing lines and the
# times come from the merge commit. The merge commit's first parent is
# the base branch tip that it merges into.
- name: Count this run's accessibility legs
@@ -2328,13 +2338,6 @@ jobs:
if: steps.scope.outputs.has_components == 'true' && steps.legs.outputs.runs != 'true'
run: echo "This leg runs no accessibility specs (${{ steps.legs.outputs.count }} leg(s) planned for this selection)."
- - name: Download Storybook artifact
- if: steps.scope.outputs.has_components == 'true' && steps.legs.outputs.runs == 'true'
- uses: actions/download-artifact@v8
- with:
- name: storybook-${{ needs.build-storybook.outputs.short_hash }}
- path: apps/storybook/dist
-
- name: Install Playwright
if: steps.scope.outputs.has_components == 'true' && steps.legs.outputs.runs == 'true'
run: pnpm install --frozen-lockfile && npx playwright install chromium