fix(ci): keep release workflows on full test coverage

This commit is contained in:
Tam Nhu Tran
2026-04-22 15:12:07 -04:00
parent c9eaae17c1
commit b314cf353e
4 changed files with 61 additions and 25 deletions
+4 -1
View File
@@ -47,9 +47,12 @@ jobs:
- name: Build
run: bun run build:all
- name: Validate (typecheck + lint + format + tests)
- name: Validate fast gate
run: bun run validate
- name: Test slow bucket
run: bun run test:slow
- name: Test CLI e2e
env:
CCS_E2E_SKIP_BUILD: '1'
+4 -1
View File
@@ -42,9 +42,12 @@ jobs:
- name: Build package
run: bun run build:all
- name: Validate (typecheck + lint + format + tests)
- name: Validate fast gate
run: bun run validate
- name: Test slow bucket
run: bun run test:slow
- name: Test CLI e2e
env:
CCS_E2E_SKIP_BUILD: '1'
+1 -1
View File
@@ -77,7 +77,7 @@
"test:ci": "bun run test:all",
"test:fast": "node scripts/run-test-bucket.js fast",
"test:slow": "node scripts/run-test-bucket.js slow",
"test:all": "bun run test:fast && bun run test:slow",
"test:all": "node scripts/run-test-bucket.js all",
"test:unit": "bun test tests/unit",
"test:npm": "bun test tests/npm/",
"test:native": "bash tests/native/unix/edge-cases.sh",
+52 -22
View File
@@ -23,8 +23,8 @@ const slowTests = [
'tests/unit/web-server/websearch-routes.test.ts',
];
if (bucket !== 'fast' && bucket !== 'slow') {
console.error('[X] Usage: node scripts/run-test-bucket.js <fast|slow>');
if (!['fast', 'slow', 'all'].includes(bucket)) {
console.error('[X] Usage: node scripts/run-test-bucket.js <fast|slow|all>');
process.exit(1);
}
@@ -66,36 +66,66 @@ const forceSlow = discovered.filter((file) => {
return readsBuiltDist(file);
});
const slowSet = new Set([...slowTests, ...forceSlow]);
const selected =
bucket === 'slow'
function selectBucket(name) {
return name === 'slow'
? [...slowSet].sort()
: discovered.filter((file) => !slowSet.has(file));
if (selected.length === 0) {
console.error(`[X] No tests matched the '${bucket}' bucket.`);
process.exit(1);
}
if (bucket === 'slow' && !fs.existsSync(path.join(rootDir, 'dist', 'ccs.js'))) {
function ensureBuildForSlowBucket() {
if (fs.existsSync(path.join(rootDir, 'dist', 'ccs.js'))) {
return 0;
}
const build = spawnSync('bun', ['run', 'build'], {
cwd: rootDir,
stdio: 'inherit',
shell: process.platform === 'win32',
});
if (build.status !== 0) {
process.exit(build.status ?? 1);
}
return build.status ?? 1;
}
const result = spawnSync(
'bun',
['test', '--max-concurrency=1', ...selected],
{
cwd: rootDir,
stdio: 'inherit',
shell: process.platform === 'win32',
},
);
function runBucket(name) {
const selected = selectBucket(name);
process.exit(result.status ?? 1);
if (selected.length === 0) {
console.error(`[X] No tests matched the '${name}' bucket.`);
return 1;
}
if (name === 'slow') {
const buildStatus = ensureBuildForSlowBucket();
if (buildStatus !== 0) {
return buildStatus;
}
}
const result = spawnSync(
'bun',
['test', '--max-concurrency=1', ...selected],
{
cwd: rootDir,
stdio: 'inherit',
shell: process.platform === 'win32',
},
);
return result.status ?? 1;
}
if (bucket === 'all') {
let exitCode = 0;
for (const name of ['fast', 'slow']) {
const status = runBucket(name);
if (status !== 0) {
exitCode = status;
}
}
process.exit(exitCode);
}
process.exit(runBucket(bucket));