An open source design system that's fully customizable and agent ready
TypeScript
ci: run typechecks beside build-storybook, not before it (#7399)
Cindy Zhanged2c62f75951
diff --git a/.github/scripts/ci-tooling-routing.test.mjs b/.github/scripts/ci-tooling-routing.test.mjsindex f14da4923a..c17e634831 100644--- a/.github/scripts/ci-tooling-routing.test.mjs+++ b/.github/scripts/ci-tooling-routing.test.mjs@@ -147,10 +147,14 @@ describe('Node-tooling CI routing', () => {}expect(ci.jobs['build-sandbox'].if).toContain(TOOLING_FALSE);- for (const candidate of ci.jobs['build-storybook'].steps) {+ for (const candidate of [+ ...ci.jobs['build-storybook'].steps,+ ...ci.jobs.typecheck.steps,+ ]) {if (candidate.name === 'Require successful scope classification' ||- candidate.name === 'Skip heavy work for a specialized lane'+ candidate.name === 'Skip heavy work for a specialized lane' ||+ candidate.name === 'Skip typechecks for a specialized lane') {continue;}@@ -170,7 +174,11 @@ describe('Node-tooling CI routing', () => {'test-build','registry-contract',]);- expect(ci.jobs.build.needs).toEqual(['build-storybook', 'build-sandbox']);+ expect(ci.jobs.build.needs).toEqual([+ 'build-storybook',+ 'build-sandbox',+ 'typecheck',+ ]);const testJoin = step(ci.jobs.test, 'Require expected test-owner outcomes');expect(testJoin.run).toBe('node .github/scripts/ci-test-join.mjs');expect(ci.jobs.test.permissions).toEqual({contents: 'read'});@@ -190,6 +198,9 @@ describe('Node-tooling CI routing', () => {).run;expect(buildJoin).toContain('needs.build-storybook.result');expect(buildJoin).toContain('needs.build-sandbox.result');+ expect(buildJoin).toContain(+ '[ "${{ needs.typecheck.result }}" = "success" ] || exit 1',+ );});it('keeps removed preview publication out of the tooling lane', () => {diff --git a/.github/scripts/release-check-workflow.test.mjs b/.github/scripts/release-check-workflow.test.mjsindex 68f082df3a..ce8ec009d5 100644--- a/.github/scripts/release-check-workflow.test.mjs+++ b/.github/scripts/release-check-workflow.test.mjs@@ -23,6 +23,7 @@ const releaseJobs = ['check-scope','check-components','build-storybook',+ 'typecheck','pr-visual','pr-a11y','pr-rtl-shard',@@ -362,6 +363,7 @@ describe('exact main and release branch completion', () => {'check-scope','check-components','build-storybook',+ 'typecheck','pr-visual','pr-a11y','pr-rtl',diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 26cff3a341..6cc935752e 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -822,52 +822,6 @@ jobs: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: 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-- name: Build Storybookif: 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 build@@ -964,6 +918,88 @@ jobs:pr-meta.jsonretention-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+# 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@@ -1049,7 +1085,7 @@ jobs:# failed check-scope) skips this gate too — both match the old single-job# behavior.build:- needs: [build-storybook, build-sandbox]+ needs: [build-storybook, build-sandbox, typecheck]if: ${{ github.event_name != 'workflow_dispatch' && !cancelled() && needs.build-storybook.result != 'skipped' }}runs-on: ubuntu-slimpermissions: {}@@ -1058,7 +1094,9 @@ jobs: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 1case "${{ needs.build-sandbox.result }}" insuccess|skipped) ;;*) exit 1 ;;@@ -2394,6 +2432,7 @@ jobs:check-scope,check-components,build-storybook,+ typecheck,pr-visual,pr-a11y,pr-rtl,@@ -2414,7 +2453,7 @@ jobs:with:script: |const needs = JSON.parse(process.env.RELEASE_NEEDS);- for (const name of ['check-scope', 'check-components', 'build-storybook', 'pr-visual', 'pr-a11y', 'pr-rtl']) {+ for (const name of ['check-scope', 'check-components', 'build-storybook', 'typecheck', 'pr-visual', 'pr-a11y', 'pr-rtl']) {if (needs[name]?.result !== 'success') {throw new Error(`Required release job ${name} did not succeed: ${needs[name]?.result}`);}