Skip to content

chore(ci): add typecheck scripts for local TypeScript verification #7

chore(ci): add typecheck scripts for local TypeScript verification

chore(ci): add typecheck scripts for local TypeScript verification #7

Workflow file for this run

name: Typecheck
# Runs `yarn typecheck` from the repository root, which invokes
# `tsc --noEmit` in every TypeScript workspace. Complements the existing
# Lint and Test workflows (which do not run tsc) and catches type errors in
# seconds instead of waiting for the slow Docker-image build in pr-gate.yml.
#
# The web workspace is excluded here because `tsc --noEmit` in `packages/web`
# depends on `.next/types/**/*.ts` (declared in its tsconfig.json `include`)
# being generated by `next build`. Web is already type-checked transitively
# via the Docker build in pr-gate.yml. See issue #1437.
on:
pull_request:
branches: ["main"]
jobs:
typecheck:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "true"
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install
run: yarn install --frozen-lockfile
# Build the type-source-of-truth workspaces first (schemas, db, shared,
# query-language) so their generated .d.ts files are fresh. Without
# this step, downstream workspaces see stale types and `tsc --noEmit`
# surfaces drift as errors.
- name: Build dependencies
run: yarn build:deps
# The db workspace's generated Prisma client must exist before its
# typecheck runs. Without this step, db's typecheck reports errors
# because the source-of-truth schema is newer than the generated client.
- name: Generate Prisma client
run: yarn workspace @sourcebot/db prisma:generate
# Excludes @sourcebot/web (see comment above). Runs tsc --noEmit in
# each remaining workspace in topological order.
- name: Typecheck
run: yarn workspaces foreach --all --topological --exclude @sourcebot/web run typecheck