Skip to content

Commit 4d2ea43

Browse files
committed
ci: skip duplicate full extension shard
1 parent 640d39d commit 4d2ea43

3 files changed

Lines changed: 61 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ jobs:
551551
echo "OPENCLAW_VITEST_MAX_WORKERS=2" >> "$GITHUB_ENV"
552552
if [ "$TASK" = "test" ]; then
553553
echo "OPENCLAW_TEST_PROJECTS_PARALLEL=6" >> "$GITHUB_ENV"
554+
echo "OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD=1" >> "$GITHUB_ENV"
554555
fi
555556
if [ "$TASK" = "channels" ]; then
556557
echo "OPENCLAW_VITEST_MAX_WORKERS=1" >> "$GITHUB_ENV"
@@ -946,6 +947,7 @@ jobs:
946947
NODE_OPTIONS: --max-old-space-size=6144
947948
# Keep total concurrency predictable on the 32 vCPU runner.
948949
OPENCLAW_VITEST_MAX_WORKERS: 1
950+
OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD: 1
949951
defaults:
950952
run:
951953
shell: bash

scripts/test-projects.test-support.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const EXTENSION_VOICE_CALL_VITEST_CONFIG = "vitest.extension-voice-call.config.t
6262
const EXTENSION_WHATSAPP_VITEST_CONFIG = "vitest.extension-whatsapp.config.ts";
6363
const EXTENSION_ZALO_VITEST_CONFIG = "vitest.extension-zalo.config.ts";
6464
const EXTENSIONS_VITEST_CONFIG = "vitest.extensions.config.ts";
65+
const FULL_EXTENSIONS_VITEST_CONFIG = "vitest.full-extensions.config.ts";
6566
const GATEWAY_VITEST_CONFIG = "vitest.gateway.config.ts";
6667
const HOOKS_VITEST_CONFIG = "vitest.hooks.config.ts";
6768
const INFRA_VITEST_CONFIG = "vitest.infra.config.ts";
@@ -621,6 +622,12 @@ export function buildFullSuiteVitestRunPlans(args, cwd = process.cwd()) {
621622
}
622623
const expandToProjectConfigs = process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS === "1";
623624
return fullSuiteVitestShards.flatMap((shard) => {
625+
if (
626+
process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD === "1" &&
627+
shard.config === FULL_EXTENSIONS_VITEST_CONFIG
628+
) {
629+
return [];
630+
}
624631
const configs = expandToProjectConfigs ? shard.projects : [shard.config];
625632
return configs.map((config) => ({
626633
config,

test/scripts/test-projects.test.ts

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ describe("scripts/test-projects changed-target routing", () => {
196196
describe("scripts/test-projects full-suite sharding", () => {
197197
it("splits untargeted runs into fixed shard configs", () => {
198198
delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS;
199+
delete process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD;
199200

200201
expect(buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config)).toEqual([
201202
"vitest.full-core-unit-fast.config.ts",
@@ -213,14 +214,35 @@ describe("scripts/test-projects full-suite sharding", () => {
213214
]);
214215
});
215216

217+
it("can skip the aggregate extension shard when CI runs dedicated extension shards", () => {
218+
const previous = process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD;
219+
process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = "1";
220+
try {
221+
const configs = buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config);
222+
223+
expect(configs).not.toContain("vitest.full-extensions.config.ts");
224+
expect(configs).toContain("vitest.full-auto-reply.config.ts");
225+
} finally {
226+
if (previous === undefined) {
227+
delete process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD;
228+
} else {
229+
process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = previous;
230+
}
231+
}
232+
});
233+
216234
it("can expand full-suite shards to project configs for perf experiments", () => {
217235
const previous = process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS;
218236
process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = "1";
219-
const plans = buildFullSuiteVitestRunPlans([], process.cwd());
220-
if (previous === undefined) {
221-
delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS;
222-
} else {
223-
process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = previous;
237+
let plans: ReturnType<typeof buildFullSuiteVitestRunPlans>;
238+
try {
239+
plans = buildFullSuiteVitestRunPlans([], process.cwd());
240+
} finally {
241+
if (previous === undefined) {
242+
delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS;
243+
} else {
244+
process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = previous;
245+
}
224246
}
225247

226248
expect(plans.map((plan) => plan.config)).toEqual([
@@ -290,6 +312,31 @@ describe("scripts/test-projects full-suite sharding", () => {
290312
);
291313
});
292314

315+
it("skips extension project configs when leaf sharding and the aggregate extension shard is disabled", () => {
316+
const previousLeafShards = process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS;
317+
const previousSkipExtensions = process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD;
318+
process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = "1";
319+
process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = "1";
320+
try {
321+
const configs = buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config);
322+
323+
expect(configs).not.toContain("vitest.extensions.config.ts");
324+
expect(configs).not.toContain("vitest.extension-providers.config.ts");
325+
expect(configs).toContain("vitest.auto-reply-reply.config.ts");
326+
} finally {
327+
if (previousLeafShards === undefined) {
328+
delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS;
329+
} else {
330+
process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = previousLeafShards;
331+
}
332+
if (previousSkipExtensions === undefined) {
333+
delete process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD;
334+
} else {
335+
process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = previousSkipExtensions;
336+
}
337+
}
338+
});
339+
293340
it("keeps untargeted watch mode on the native root config", () => {
294341
expect(buildFullSuiteVitestRunPlans(["--watch"], process.cwd())).toEqual([
295342
{

0 commit comments

Comments
 (0)