mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:20:43 +00:00
ci: reduce node runner fanout
This commit is contained in:
@@ -41,14 +41,9 @@ export function createChannelContractTestShards() {
|
||||
const rootDir = "src/channels/plugins/contracts";
|
||||
const suffixes = ["a", "b", "c"];
|
||||
const groups = Object.fromEntries(
|
||||
["registry", "core"].flatMap((family) =>
|
||||
suffixes.map((suffix) => [`checks-fast-contracts-channels-${family}-${suffix}`, []]),
|
||||
),
|
||||
suffixes.map((suffix) => [`checks-fast-contracts-channels-${suffix}`, []]),
|
||||
);
|
||||
const groupKeys = {
|
||||
core: suffixes.map((suffix) => `checks-fast-contracts-channels-core-${suffix}`),
|
||||
registry: suffixes.map((suffix) => `checks-fast-contracts-channels-registry-${suffix}`),
|
||||
};
|
||||
const groupKeys = suffixes.map((suffix) => `checks-fast-contracts-channels-${suffix}`);
|
||||
const weights = Object.fromEntries(Object.keys(groups).map((key) => [key, 0]));
|
||||
const pushBalanced = (keys, file) => {
|
||||
const target = keys.toSorted((a, b) => weights[a] - weights[b] || a.localeCompare(b))[0];
|
||||
@@ -71,10 +66,10 @@ export function createChannelContractTestShards() {
|
||||
return delta === 0 ? left.localeCompare(right) : delta;
|
||||
};
|
||||
for (const file of registryFiles.toSorted(byDescendingWeight)) {
|
||||
pushBalanced(groupKeys.registry, file);
|
||||
pushBalanced(groupKeys, file);
|
||||
}
|
||||
for (const file of coreFiles.toSorted(byDescendingWeight)) {
|
||||
pushBalanced(groupKeys.core, file);
|
||||
pushBalanced(groupKeys, file);
|
||||
}
|
||||
|
||||
return Object.entries(groups).map(([checkName, includePatterns]) => ({
|
||||
|
||||
@@ -87,6 +87,36 @@ function createAutoReplyReplySplitShards() {
|
||||
}
|
||||
|
||||
const SPLIT_NODE_SHARDS = new Map([
|
||||
[
|
||||
"core-unit-fast",
|
||||
[
|
||||
{
|
||||
shardName: "core-unit-fast-support",
|
||||
configs: [
|
||||
"test/vitest/vitest.unit-fast.config.ts",
|
||||
"test/vitest/vitest.unit-support.config.ts",
|
||||
],
|
||||
includeExternalConfigs: true,
|
||||
requiresDist: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
[
|
||||
"core-unit-src",
|
||||
[
|
||||
{
|
||||
shardName: "core-unit-src-security",
|
||||
configs: [
|
||||
"test/vitest/vitest.unit-src.config.ts",
|
||||
"test/vitest/vitest.unit-security.config.ts",
|
||||
],
|
||||
includeExternalConfigs: true,
|
||||
requiresDist: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
["core-unit-security", []],
|
||||
["core-unit-support", []],
|
||||
[
|
||||
"core-runtime",
|
||||
[
|
||||
@@ -205,7 +235,9 @@ export function createNodeTestShards() {
|
||||
const splitShards = SPLIT_NODE_SHARDS.get(shard.name);
|
||||
if (splitShards) {
|
||||
return splitShards.flatMap((splitShard) => {
|
||||
const splitConfigs = splitShard.configs.filter((config) => configs.includes(config));
|
||||
const splitConfigs = splitShard.includeExternalConfigs
|
||||
? splitShard.configs
|
||||
: splitShard.configs.filter((config) => configs.includes(config));
|
||||
if (splitConfigs.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user