fix: isolate artifact rebuild from release suites
Memind CI / Test, build, and release guards (push) Has been cancelled

This commit is contained in:
john
2026-07-26 15:19:30 +08:00
parent b1577a16e9
commit ea07f6f250
3 changed files with 50 additions and 2 deletions
+25 -1
View File
@@ -72,6 +72,30 @@ export async function runWithConcurrency(items, concurrency, worker) {
return results;
}
// Some suites intentionally mutate the shared candidate artifact. Run those
// suites before the parallel batch so they cannot race suites that boot the
// same runtime while it is being rebuilt.
export async function runSuitesWithConcurrency(items, concurrency, worker) {
const results = new Array(items.length);
const parallel = [];
for (let index = 0; index < items.length; index += 1) {
if (items[index].exclusive) {
results[index] = await worker(items[index], index);
} else {
parallel.push({ item: items[index], index });
}
}
const parallelResults = await runWithConcurrency(
parallel,
concurrency,
({ item, index }) => worker(item, index),
);
for (let index = 0; index < parallel.length; index += 1) {
results[parallel[index].index] = parallelResults[index];
}
return results;
}
export async function runCommand(command, args, {
cwd = ROOT,
timeoutMs = 15 * 60 * 1000,
@@ -220,7 +244,7 @@ export async function executeReleaseGate(options) {
);
const suites = AUTOMATION_SUITES.filter((candidate) => suiteIsInMode(candidate, options.mode));
const executions = await runWithConcurrency(
const executions = await runSuitesWithConcurrency(
suites,
options.suiteConcurrency,
(suite) => runSuite(suite, outputDir, options.timeoutMs),