Skip to content

Add tool-level caching to CI lint-and-typecheck #204

@jakebromberg

Description

@jakebromberg

Context

The lint-and-typecheck CI job re-processes every file from scratch on every run.
TypeScript incremental: true is configured but .tsbuildinfo files aren't cached in CI.
ESLint and Prettier have no --cache flags enabled. Adding file-level caching to all
three tools lets subsequent CI runs skip unchanged files.

Changes

1. Move shared package .tsbuildinfo out of dist/

Both shared/database and shared/authentication have outDir: "./dist" in their tsconfigs,
so tsc --noEmit --incremental writes .tsbuildinfo into dist/. But tsup's clean: true
wipes dist/ before every build, destroying the cached build info. Fix: add tsBuildInfoFile
to place it in .cache/ instead.

2. Add --cache flags to ESLint and Prettier scripts

  • --cache-strategy content for ESLint because git checkout resets mtimes; content hashing is stable.
  • Prettier uses content hashing by default.
  • Explicit --cache-location .cache/<tool>/ keeps all caches in one predictable directory.

3. Ignore .cache/ in tooling

Add .cache to .gitignore, .prettierignore, and ESLint's global ignores.

4. Add CI cache step for tool artifacts

Add actions/cache@v4 step to .github/workflows/test.yml with config-aware cache keys
and cross-commit/cross-branch restore fallbacks.

Files modified

File Change
shared/database/tsconfig.json Add tsBuildInfoFile
shared/authentication/tsconfig.json Add tsBuildInfoFile
package.json Add --cache flags to lint/format scripts
.gitignore Add .cache
.prettierignore Add .cache
eslint.config.mjs Add '**/.cache/' to ignores
.github/workflows/test.yml Add tool cache step

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions