* ci: split coverage across two file shards and merge on a small report job Coverage runs as a three-lane matrix: two instrumented file shards that deal path-sorted test files in snake order (DSH_COVERAGE_SHARD) and the uninstrumented heavy suites. Each shard uploads its blobs, file list, and durations; node-24-coverage-report re-lists the inventory, checks the shards partition it, merges the blobs with thresholds on a 2-vCPU runner, and alone saves the duration history. Only the report job joins all-checks-passed. * ci: run the coverage heavy suites on the first shard and split shards by file size The exempt heavy suites finished in about a minute on a dedicated 16-vCPU runner, so they join shard 1 with the coverage lane's usual worker split. Shards now deal files largest first by byte size instead of by path order, so the heaviest suites no longer land on one shard. The coordinator repeats each failed partition and its Vitest FAIL lines after all partitions finish, and run-gates.spec clears DSH_COVERAGE_SHARD inherited from the CI shard. * ci: give the coverage merge a 4 GB heap on the small report runner Merging both shards' blobs exhausted Node's default heap of about 2 GB on the 2-vCPU report runner (run 44664262449). * ci: merge coverage shards on an 8-vCPU runner The merge took 154s on the 2-vCPU report runner against ~30s on the former 16-vCPU lane (run 44667701311). * ci: address review on the coverage shards - Shards record their checkout root, and the merge rewrites that prefix in blobs from another checkout so one source file never merges as two. - Shard blob uploads overwrite on a re-run of the same workflow run. - The coverage report lane joins the runner-temp and compile-cache lane lists in ci-workflow.spec. - The failover runbook states the self-hosted shard and exempt workers. * ci: address the second coverage-shard review and leftover lane cleanup - The cross-checkout blob rewrite spec builds roots and paths with join(), so it holds on Windows, where the rewrite prefix ends in a backslash. - The failover runbook names the current coverage, build, consumer, and web snapshot checks instead of the former single-job names. - node-24-build and node-24-consumers drop env variables that none of their gates read.
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
/** CLI entry for partitioned Vitest coverage, optionally limited to one `DSH_COVERAGE_SHARD` file shard. */
|
|
import { resolve } from 'node:path'
|
|
import {
|
|
COVERAGE_PARTITIONS_ENV,
|
|
COVERAGE_SHARD_ENV,
|
|
CoveragePartitionCoordinator,
|
|
forwardedCoverageArgs,
|
|
parseCoveragePartitionCount,
|
|
parseCoverageShard,
|
|
} from './coverage-partitions.ts'
|
|
|
|
const partitions = parseCoveragePartitionCount(process.env[COVERAGE_PARTITIONS_ENV])
|
|
if (partitions === undefined) {
|
|
throw new Error(`${COVERAGE_PARTITIONS_ENV} is required by partitioned coverage.`)
|
|
}
|
|
const pnpmEntrypoint = process.env.npm_execpath
|
|
if (pnpmEntrypoint === undefined || pnpmEntrypoint === '') {
|
|
throw new Error('partitioned coverage must be invoked through a pnpm package script.')
|
|
}
|
|
|
|
const shard = parseCoverageShard(process.env[COVERAGE_SHARD_ENV])
|
|
const coordinator = new CoveragePartitionCoordinator({
|
|
root: resolve(import.meta.dirname, '..'),
|
|
partitions,
|
|
pnpmEntrypoint,
|
|
vitestArgs: forwardedCoverageArgs(process.argv.slice(2)),
|
|
...shard === undefined ? {} : { shard },
|
|
})
|
|
process.exitCode = await coordinator.run()
|