fix(ci): split unit-fast into bounded shared-worker lanes

This commit is contained in:
Shakker
2026-03-20 05:08:39 +00:00
committed by Shakker
parent 4d9ae5899d
commit 94ab044387
3 changed files with 91 additions and 38 deletions

View File

@@ -9,6 +9,24 @@ import {
const base = baseConfig as unknown as Record<string, unknown>;
const baseTest = (baseConfig as { test?: { include?: string[]; exclude?: string[] } }).test ?? {};
const exclude = baseTest.exclude ?? [];
function loadPatternListFile(filePath: string, label: string): string[] {
const parsed = JSON.parse(fs.readFileSync(filePath, "utf8")) as unknown;
if (!Array.isArray(parsed)) {
throw new TypeError(`${label} must point to a JSON array: ${filePath}`);
}
return parsed.filter((value): value is string => typeof value === "string" && value.length > 0);
}
export function loadIncludePatternsFromEnv(
env: Record<string, string | undefined> = process.env,
): string[] | null {
const includeFile = env.OPENCLAW_VITEST_INCLUDE_FILE?.trim();
if (!includeFile) {
return null;
}
return loadPatternListFile(includeFile, "OPENCLAW_VITEST_INCLUDE_FILE");
}
export function loadExtraExcludePatternsFromEnv(
env: Record<string, string | undefined> = process.env,
): string[] {
@@ -16,20 +34,14 @@ export function loadExtraExcludePatternsFromEnv(
if (!extraExcludeFile) {
return [];
}
const parsed = JSON.parse(fs.readFileSync(extraExcludeFile, "utf8")) as unknown;
if (!Array.isArray(parsed)) {
throw new TypeError(
`OPENCLAW_VITEST_EXTRA_EXCLUDE_FILE must point to a JSON array: ${extraExcludeFile}`,
);
}
return parsed.filter((value): value is string => typeof value === "string" && value.length > 0);
return loadPatternListFile(extraExcludeFile, "OPENCLAW_VITEST_EXTRA_EXCLUDE_FILE");
}
export default defineConfig({
...base,
test: {
...baseTest,
include: unitTestIncludePatterns,
include: loadIncludePatternsFromEnv() ?? unitTestIncludePatterns,
exclude: [
...new Set([
...exclude,