perf(ci): start long node shards first (#106522)

This commit is contained in:
Peter Steinberger
2026-07-13 09:56:30 -07:00
committed by GitHub
parent 2ec0299f9f
commit 8814e75cd6
3 changed files with 21 additions and 1 deletions

View File

@@ -35,6 +35,12 @@ const TOOLING_CONFIG = "test/vitest/vitest.tooling.config.ts";
const TOOLING_DOCKER_TEST_FILE = "test/scripts/docker-build-helper.test.ts";
const TOOLING_ISOLATED_CONFIG = "test/vitest/vitest.tooling-isolated.config.ts";
const TOOLING_ISOLATED_TEST_FILE = "test/scripts/openclaw-e2e-instance.test.ts";
// The full matrix is capped at 28 jobs. Admit the consistently slow serial
// shards first so short alphabetical groups cannot leave them on the tail.
const FULL_NODE_TEST_ADMISSION_PRIORITY = new Map([
["core-tooling", 0],
["auto-reply-reply-commands", 1],
]);
// Commands and cron run non-isolated, so keep their split shards as separate
// processes. Combining their include lists can retain test state across groups.
const BUNDLEABLE_NODE_TEST_CONFIGS = new Set(["test/vitest/vitest.infra.config.ts"]);
@@ -1013,6 +1019,15 @@ function bundleNameForConfigs(configs) {
.replace(/[^a-z0-9-]+/giu, "-");
}
function compareFullNodeTestAdmissionOrder(a, b) {
const fallbackPriority = FULL_NODE_TEST_ADMISSION_PRIORITY.size;
return (
(FULL_NODE_TEST_ADMISSION_PRIORITY.get(a.shardName) ?? fallbackPriority) -
(FULL_NODE_TEST_ADMISSION_PRIORITY.get(b.shardName) ?? fallbackPriority) ||
a.checkName.localeCompare(b.checkName)
);
}
function createStripedBatches(values, batchCount) {
const batches = Array.from({ length: batchCount }, () => []);
for (const [index, value] of values.entries()) {
@@ -1144,7 +1159,7 @@ export function createNodeTestShardBundles(options = {}) {
}
}
return [...unbundled, ...bundled].toSorted((a, b) => a.checkName.localeCompare(b.checkName));
return [...unbundled, ...bundled].toSorted(compareFullNodeTestAdmissionOrder);
}
function createCompactNodeTestShardBundles(options = {}) {