Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
ci: run docs tests when apps/docs changes (MUL-9326) (#10661)
Jiayuan Zhanga5f7cf8ec15e
diff --git a/.github/ci-paths.json b/.github/ci-paths.jsonindex 6e44b862bb..43b2088483 100644--- a/.github/ci-paths.json+++ b/.github/ci-paths.json@@ -16,6 +16,18 @@"scripts/ci-scope.mjs","scripts/ci-scope.test.mjs"],+ "docs": [+ "apps/docs/**",+ "package.json",+ ".npmrc",+ "pnpm-lock.yaml",+ "pnpm-workspace.yaml",+ "patches/**",+ ".github/workflows/ci.yml",+ ".github/ci-paths.json",+ "scripts/ci-scope.mjs",+ "scripts/ci-scope.test.mjs"+ ],"backend": ["server/**","packages/core/runtimes/cli-version.ts",diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 42d5911879..d02dea67cb 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -23,6 +23,7 @@ jobs:pull-requests: readoutputs:frontend: ${{ steps.decide.outputs.frontend }}+ docs: ${{ steps.decide.outputs.docs }}backend: ${{ steps.decide.outputs.backend }}sqlc: ${{ steps.decide.outputs.sqlc }}runtime: ${{ steps.decide.outputs.runtime }}@@ -257,9 +258,37 @@ jobs:- name: Test views shard ${{ matrix.index }}/${{ matrix.total }}run: pnpm exec turbo test --filter='@multica/views' -- --shard=${{ matrix.index }}/${{ matrix.total }}+ # The jobs above exclude docs because a per-PR `next build` of the docs site+ # was too heavy (#1279). Its Vitest suite is not: it guards content such as+ # unrendered CJK bold and finishes in seconds. It gets its own scope so a+ # content-only PR runs it and an unrelated PR pays nothing, and installs only+ # the docs package so the job stays far off the frontend critical path.+ docs-test:+ needs: changes+ if: ${{ needs.changes.outputs.docs == 'true' }}+ runs-on: ubuntu-latest+ steps:+ - name: Checkout+ uses: actions/checkout@v6++ - name: Setup pnpm+ uses: pnpm/action-setup@v4++ - name: Setup Node.js+ uses: actions/setup-node@v6+ with:+ node-version: 22+ cache: pnpm++ - name: Install docs dependencies+ run: pnpm install --frozen-lockfile --filter @multica/docs++ - name: Test docs+ run: pnpm --filter @multica/docs test+# Preserve the aggregate check names while validating intentional skips.frontend:- needs: [changes, frontend-build, frontend-test, frontend-views-test, frontend-quality]+ needs: [changes, frontend-build, frontend-test, frontend-views-test, frontend-quality, docs-test]if: ${{ !cancelled() }}runs-on: ubuntu-lateststeps:@@ -267,7 +296,7 @@ jobs:- name: Check frontend job resultsenv:NEEDS_JSON: ${{ toJSON(needs) }}- JOB_SCOPES: '{"frontend-build":"frontend","frontend-test":"frontend","frontend-views-test":"frontend","frontend-quality":"quality_only"}'+ JOB_SCOPES: '{"frontend-build":"frontend","frontend-test":"frontend","frontend-views-test":"frontend","frontend-quality":"quality_only","docs-test":"docs"}'run: node scripts/ci-scope.mjs gate# The Go caches are handled explicitly here rather than through setup-go'sdiff --git a/scripts/ci-scope.test.mjs b/scripts/ci-scope.test.mjsindex 5df0b8600d..4fabd2583c 100644--- a/scripts/ci-scope.test.mjs+++ b/scripts/ci-scope.test.mjs@@ -17,7 +17,8 @@ function filterFiles(files) {for (const [name, files, selected] of [["readme only", ["README.md"], []],- ["docs only", ["apps/docs/content/docs/guide.mdx"], ["quality"]],+ ["docs only", ["apps/docs/content/docs/guide.mdx"], ["quality", "docs"]],+ ["docs test", ["apps/docs/lib/unrendered-bold.test.ts"], ["quality", "docs"]],["web changelog", ["apps/web/features/landing/i18n/en.ts"], ["frontend", "quality"]],["mobile UI", ["apps/mobile/app/index.tsx"], ["quality"]],["migration only", ["server/migrations/999_example.up.sql"], ["backend", "sqlc"]],@@ -51,13 +52,14 @@ for (const [name, files, selected] of [["PR evidence uploader", ["scripts/pr-shots"], ["quality"]],["cross-module runtime contract", ["packages/core/runtimes/cli-version.ts"], ["frontend", "backend", "runtime", "quality"]],["shared quick action body contract", ["server/internal/handler/testdata/quick_action_bodies.json"], ["frontend", "backend", "runtime"]],- ["lockfile", ["pnpm-lock.yaml"], ["frontend", "quality"]],- ["workspace package patch", ["patches/example.patch"], ["frontend", "quality"]],+ ["lockfile", ["pnpm-lock.yaml"], ["frontend", "quality", "docs"]],+ ["workspace catalog", ["pnpm-workspace.yaml"], ["frontend", "quality", "docs"]],+ ["workspace package patch", ["patches/example.patch"], ["frontend", "quality", "docs"]],["mobile package patch", ["apps/mobile/patches/example.patch"], ["quality"]],["radius policy", ["scripts/check-ui-radius-tokens.mjs"], ["quality"]],["shared quality action", [".github/actions/frontend-quality/action.yml"], ["frontend", "quality"]],["new bitmap", ["apps/web/public/hero.png"], ["frontend", "quality", "images"]],- ["mixed docs and migration", ["apps/docs/content/guide.mdx", "server/migrations/999_example.up.sql"], ["quality", "backend", "sqlc"]],+ ["mixed docs and migration", ["apps/docs/content/guide.mdx", "server/migrations/999_example.up.sql"], ["quality", "docs", "backend", "sqlc"]],["CI configuration", [".github/ci-paths.json"], Object.keys(filters)],]) {test(`PR and main select only affected scopes: ${name}`, () => {@@ -201,6 +203,17 @@ test("quality checks have exactly one runner", () => {}});+test("docs run their test suite on one runner and are never built", () => {+ const owners = Object.entries(jobs).filter(([, source]) => source.includes("--filter @multica/docs test")).map(([job]) => job);+ assert.deepEqual(owners, ["docs-test"]);+ assert.equal(productionMapping("frontend")["docs-test"], "docs");+ for (const [job, source] of Object.entries(jobs)) {+ for (const [run] of source.matchAll(/turbo build[^\n]*/g)) {+ assert.match(run, /--filter='!@multica\/docs'/, `${job} builds docs`);+ }+ }+});+test("the CLI writes real Actions outputs and exits nonzero on a failed gate", (t) => {const dir = mkdtempSync(join(tmpdir(), "ci-scope-"));t.after(() => rmSync(dir, { recursive: true, force: true }));