An open source design system that's fully customizable and agent ready
TypeScript
ci: run the visual scout and axe shard legs on four cores (#7441)
Cindy Zhang06e35f5a8264
diff --git a/.github/scripts/release-check-workflow.test.mjs b/.github/scripts/release-check-workflow.test.mjsindex cb011fd250..1338f767d4 100644--- a/.github/scripts/release-check-workflow.test.mjs+++ b/.github/scripts/release-check-workflow.test.mjs@@ -689,6 +689,13 @@ describe('full release scope without PR metadata or maintenance writes', () => {'pnpm test:a11y-contract --shard=${{ matrix.shard }}/${{ strategy.job-total }}',);expect(contracts.env.A11Y_CONTRACT_WORKERS).toBe(4);+ // Shard legs that run four pages or workers get four cores.+ for (const job of ['visual-scout', 'pr-a11y-shard']) {+ expect(jobs[job]['runs-on'], job).toBe('4-core-ubuntu');+ }+ expect(+ step('visual-scout', 'Scout this shard of the release plan').run,+ ).toContain('--concurrency 4');// Four workers need four cores; on two the CPU-bound specs time out.expect(jobs['a11y-contracts-shard']['runs-on']).toBe('4-core-ubuntu');expect(contracts['continue-on-error']).toBeUndefined();diff --git a/.github/scripts/visual-gate/gate.mjs b/.github/scripts/visual-gate/gate.mjsindex aaa336b82d..0043b28656 100644--- a/.github/scripts/visual-gate/gate.mjs+++ b/.github/scripts/visual-gate/gate.mjs@@ -655,6 +655,15 @@ async function main() {const {scoutStoryIds} = await plan({scoutOnly: true});if (!scoutStoryIds) throw new Error('The release plan scouts nothing.');const mine = shardStoryIds(scoutStoryIds, shard);+ // A shard job may run on a bigger runner than the config's pages assume.+ if (has('concurrency') && flag('concurrency') === undefined) {+ throw new Error('--concurrency requires a value.');+ }+ const pages = flag('concurrency') ?? String(config.scoutConcurrency);+ const concurrency = Number(pages);+ if (!Number.isInteger(concurrency) || concurrency < 1) {+ throw new Error(`--concurrency must be a positive integer, got ${pages}.`);+ }process.stderr.write(`Scouting shard ${shard.index}/${shard.count}: ${mine.length} of ${scoutStoryIds.length} stories…\n`,);@@ -663,7 +672,7 @@ async function main() {storybookDir,theme: config.defaultTheme,viewport: config.viewport,- concurrency: config.scoutConcurrency,+ concurrency,});fs.mkdirSync(path.dirname(path.resolve(out)), {recursive: true});fs.writeFileSync(diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 46aad95a5a..f12eec3da8 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -1124,7 +1124,9 @@ jobs:fail-fast: falsematrix:shard: [1, 2, 3]- runs-on: 2-core-ubuntu-arm+ # 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-ubuntupermissions:contents: readsteps:@@ -2121,7 +2123,9 @@ jobs:fail-fast: falsematrix:shard: [1, 2, 3]- runs-on: 2-core-ubuntu-arm+ # 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-ubuntupermissions:contents: readsteps:@@ -2160,6 +2164,7 @@ jobs:--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