mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 14:16:16 -08:00
perf(ci): skip unit coverage on PRs that cannot reach it and persist the Jest cache (#1711)
Pull requests whose changes cannot reach any Tier A test (allowlist checked against declared Tier A inputs and an AST scan of cross-project reads) skip the unit coverage suite; master pushes always run it. Jest's transform cache is persisted with actions/cache: PRs restore only, master pushes start empty and save. Paired CI runs: Tier A 9m04s cold -> 6m09s warm. Nx Cloud is intentionally not used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34d393adc8
commit
e8902f472a
9 files changed
+648
-3
No files matched your search
@@ -82,6 +82,28 @@ type-checking each through a language service; spec type errors therefore do
|
||||
not fail Jest (the web configs already ran with `diagnostics: false`), while
|
||||
`isolatedModules`-incompatible syntax such as a type re-export without
|
||||
`export type` still fails at load time.
|
||||
|
||||
In CI, a pull request skips the Tier A suite (and the merged-coverage upload)
|
||||
when every changed file is outside Tier A test inputs:
|
||||
`tools/coverage/unit-coverage-scope.mjs` holds the allowlist (Markdown, `docs/`,
|
||||
notes and plans, agent guidance, workflows other than `ci.yml` and
|
||||
`build-and-make.yaml`, the website, E2E and mock-server apps,
|
||||
release/packaging/skills/performance tooling, and a `package.json` edit
|
||||
confined to non-`coverage:*` scripts). Anything else, including files no Nx
|
||||
project owns such as `jest.preset.js` or `tsconfig.base.json`, and every
|
||||
`{workspaceRoot}` input a Tier A test target declares, runs the full suite;
|
||||
master pushes always run it. `nx affected` is deliberately not used for this
|
||||
decision because a change to an unowned file affects no project. A node test
|
||||
parses every Tier A source for string literals that point at repository files
|
||||
outside the owning project (`tier-a-external-references.mjs`) and fails if the
|
||||
allowlist would skip any of them, so a new cross-project read cannot be
|
||||
silently exempted.
|
||||
Jest's transform cache is kept in `JEST_CACHE_DIRECTORY` and persisted with
|
||||
`actions/cache`: pull requests restore it, while only master pushes (starting
|
||||
from an empty cache, so it holds exactly the current tree) and maintainer
|
||||
dispatches save it. A shared Nx task cache is not used: Nx indexes its local
|
||||
cache in a machine-specific database, so a restored cache folder is never hit,
|
||||
and sharing it safely needs Nx Cloud or another supported remote cache.
|
||||
`coverage:merge` requires every configured Tier A report before replacing the
|
||||
merged output. Strict health validation also requires the merged Istanbul map
|
||||
itself to contain usable instrumentation for every runtime-owning Tier A file,
|
||||
|
||||
Reference in new issue
Block a user