mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 18:18:43 +00:00
fix(ci): keep release workflows on full test coverage
This commit is contained in:
@@ -47,9 +47,12 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: bun run build:all
|
run: bun run build:all
|
||||||
|
|
||||||
- name: Validate (typecheck + lint + format + tests)
|
- name: Validate fast gate
|
||||||
run: bun run validate
|
run: bun run validate
|
||||||
|
|
||||||
|
- name: Test slow bucket
|
||||||
|
run: bun run test:slow
|
||||||
|
|
||||||
- name: Test CLI e2e
|
- name: Test CLI e2e
|
||||||
env:
|
env:
|
||||||
CCS_E2E_SKIP_BUILD: '1'
|
CCS_E2E_SKIP_BUILD: '1'
|
||||||
|
|||||||
@@ -42,9 +42,12 @@ jobs:
|
|||||||
- name: Build package
|
- name: Build package
|
||||||
run: bun run build:all
|
run: bun run build:all
|
||||||
|
|
||||||
- name: Validate (typecheck + lint + format + tests)
|
- name: Validate fast gate
|
||||||
run: bun run validate
|
run: bun run validate
|
||||||
|
|
||||||
|
- name: Test slow bucket
|
||||||
|
run: bun run test:slow
|
||||||
|
|
||||||
- name: Test CLI e2e
|
- name: Test CLI e2e
|
||||||
env:
|
env:
|
||||||
CCS_E2E_SKIP_BUILD: '1'
|
CCS_E2E_SKIP_BUILD: '1'
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@
|
|||||||
"test:ci": "bun run test:all",
|
"test:ci": "bun run test:all",
|
||||||
"test:fast": "node scripts/run-test-bucket.js fast",
|
"test:fast": "node scripts/run-test-bucket.js fast",
|
||||||
"test:slow": "node scripts/run-test-bucket.js slow",
|
"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:unit": "bun test tests/unit",
|
||||||
"test:npm": "bun test tests/npm/",
|
"test:npm": "bun test tests/npm/",
|
||||||
"test:native": "bash tests/native/unix/edge-cases.sh",
|
"test:native": "bash tests/native/unix/edge-cases.sh",
|
||||||
|
|||||||
+52
-22
@@ -23,8 +23,8 @@ const slowTests = [
|
|||||||
'tests/unit/web-server/websearch-routes.test.ts',
|
'tests/unit/web-server/websearch-routes.test.ts',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (bucket !== 'fast' && bucket !== 'slow') {
|
if (!['fast', 'slow', 'all'].includes(bucket)) {
|
||||||
console.error('[X] Usage: node scripts/run-test-bucket.js <fast|slow>');
|
console.error('[X] Usage: node scripts/run-test-bucket.js <fast|slow|all>');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,36 +66,66 @@ const forceSlow = discovered.filter((file) => {
|
|||||||
return readsBuiltDist(file);
|
return readsBuiltDist(file);
|
||||||
});
|
});
|
||||||
const slowSet = new Set([...slowTests, ...forceSlow]);
|
const slowSet = new Set([...slowTests, ...forceSlow]);
|
||||||
const selected =
|
|
||||||
bucket === 'slow'
|
function selectBucket(name) {
|
||||||
|
return name === 'slow'
|
||||||
? [...slowSet].sort()
|
? [...slowSet].sort()
|
||||||
: discovered.filter((file) => !slowSet.has(file));
|
: 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'], {
|
const build = spawnSync('bun', ['run', 'build'], {
|
||||||
cwd: rootDir,
|
cwd: rootDir,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
shell: process.platform === 'win32',
|
shell: process.platform === 'win32',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (build.status !== 0) {
|
return build.status ?? 1;
|
||||||
process.exit(build.status ?? 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = spawnSync(
|
function runBucket(name) {
|
||||||
'bun',
|
const selected = selectBucket(name);
|
||||||
['test', '--max-concurrency=1', ...selected],
|
|
||||||
{
|
|
||||||
cwd: rootDir,
|
|
||||||
stdio: 'inherit',
|
|
||||||
shell: process.platform === 'win32',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
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));
|
||||||
|
|||||||
Reference in New Issue
Block a user