# The TypeScript packages gate: typecheck, tests and the contract checks for # packages/**, examples/**, website and tooling/**, the docs kit's tests, and # the docs gate. Called by ci.yml (the umbrella that owns the PR gate); never # triggered on its own. # # Turbo does the scoping: with the cache restored (local cache dir below, # remote cache when TURBO_TOKEN/TURBO_TEAM are configured), an unchanged # package is a cache hit and only what a PR touched — plus its dependents — # actually runs. `typecheck` and `test` depend on `^build` (turbo.json), so a # package's dependencies are built first — boundary packages publish dist # types, the Angular adapter is ng-packagr output, some tests read generated # artifacts — and those builds are cached like everything else. # # cloudpdf/** is deliberately outside this gate: the server matrix, the # engine conformance suite and SDK generation cover it with the runtimes # they need (see ci.yml). name: packages on: workflow_call: {} permissions: contents: read env: CI: true # .npmrc interpolates it; empty beats a WARN on public installs. NPM_TOKEN: '' # Remote cache, when the repository configures it (no-ops otherwise). TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ vars.TURBO_TEAM }} jobs: typecheck: name: typecheck runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v5 with: run_install: false - uses: actions/setup-node@v6 with: node-version: 22 cache: pnpm - name: Install deps run: pnpm install --frozen-lockfile - name: Restore turbo cache uses: actions/cache@v4 with: path: .turbo/cache key: turbo-typecheck-${{ runner.os }}-${{ github.sha }} restore-keys: | turbo-typecheck-${{ runner.os }}- # The engine packages in the build closure inline the wasm32 runtime at # build time: hydrate it from the content-addressed shelf. A PR that # changes runtime sources races its own Build PDF Runtime workflow, # hence the wait. - name: Fetch engine runtime payload run: pnpm --filter @embedpdf/engine-runtime fetch:payload env: EPDF_PAYLOAD_WAIT_MINUTES: '30' - name: Typecheck run: pnpm turbo run typecheck --continue test: name: test runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v5 with: run_install: false - uses: actions/setup-node@v6 with: node-version: 22 cache: pnpm - name: Install deps run: pnpm install --frozen-lockfile - name: Restore turbo cache uses: actions/cache@v4 with: path: .turbo/cache key: turbo-test-${{ runner.os }}-${{ github.sha }} restore-keys: | turbo-test-${{ runner.os }}- # Suites that boot a local engine (form, annotation, signature, …) run # the wasm32 runtime in Node, and the engine's `(native)` variants the # host's addon (linux-x64 here); hydrate both from the content-addressed # shelf like build-hygiene and Vercel do. A PR that changes runtime # sources races its own Build PDF Runtime workflow, hence the wait. - name: Fetch engine runtime payloads run: pnpm --filter @embedpdf/engine-runtime fetch:payload wasm32 linux-x64 env: EPDF_PAYLOAD_WAIT_MINUTES: '30' - name: Test run: >- pnpm turbo run test --continue --filter='./packages/**' --filter='./examples/**' --filter='./website' --filter='./docs/kit' --filter='./tooling/**' # The docs gate (docs/conventions/docs-architecture.md): every docs page's snippets, and the # code a viewer page shows, compiled against the packages in this commit, per framework, and # which pages are live (docs/content/scripts/publish-gate.mjs). A viewer page that doesn't # compile yet is held back on the site and fails nothing here; the job fails when a check # crashes or stops checking, or when a headless page, or a viewer page a package's README # shows, stops compiling (`--strict`). docs: name: docs gate runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v5 with: run_install: false - uses: actions/setup-node@v6 with: node-version: 22 cache: pnpm - name: Install deps run: pnpm install --frozen-lockfile # The snippets read every package at its source, except the engine runtime's types, which # only its build has; the build inlines the wasm32 runtime, hydrated from the shelf. - name: Fetch engine runtime payload run: pnpm --filter @embedpdf/engine-runtime fetch:payload wasm32 env: EPDF_PAYLOAD_WAIT_MINUTES: '30' - name: Build the engine runtime run: pnpm turbo run build --filter=@embedpdf/engine-runtime - name: Test the docs checks run: node --test docs/content/scripts/*.test.mjs - name: Snippets and live pages run: node docs/content/scripts/publish-gate.mjs --strict - name: Keep the status if: ${{ !cancelled() }} uses: actions/upload-artifact@v6 with: name: docs-gate-status path: | docs/content/generated/snippet-status.json docs/content/generated/live-pages.json if-no-files-found: ignore contract: name: contract runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v5 with: run_install: false - uses: actions/setup-node@v6 with: node-version: 22 cache: pnpm - name: Install deps run: pnpm install --frozen-lockfile - name: Test the release scripts run: node --test scripts/*.test.mjs - name: Test the boundary checker run: pnpm --filter @embedpdf/tooling-build test - name: Plugin boundaries run: pnpm check:plugin-boundaries # Plugin shape (docs/conventions/plugins.md): manifests hold only the # factory, events are subscribed through the context, no `as never`. - name: Plugin architecture run: pnpm check:architecture # No public-CDN or other off-origin URL literal ships in viewer or engine # source — the code half of docs/viewer/self-hosting's guarantee. - name: No off-origin URL literals in shipped source run: pnpm check:network-literals # Comments follow docs/conventions/comments.md: nothing a reader cannot # follow (plans, decisions, history, missing docs), no capitals for emphasis. - name: Comment conventions run: pnpm check:comments # The public API of every published entry is snapshotted in api/; a PR # that changes a surface regenerates the snapshot (`pnpm api:snapshot`) # so the review sees the diff, and a drift here is a PR that forgot. - name: API snapshot is current run: pnpm api:check # A package's README is written from the docs page that documents it # (docs/conventions/docs-architecture.md); a PR that changes the page, the # README's frame or the package's description writes it again # (`pnpm readme:sync`), and a drift here is a PR that forgot. - name: Package READMEs are current run: pnpm readme:check