From 4d2ea434d243c2a1683f3dca3c3ed1a65a648003 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 8 Apr 2026 13:03:18 +0100 Subject: [PATCH] ci: skip duplicate full extension shard --- .github/workflows/ci.yml | 2 + scripts/test-projects.test-support.mjs | 7 ++++ test/scripts/test-projects.test.ts | 57 +++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4e7f9b863b..35791d05e4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -551,6 +551,7 @@ jobs: echo "OPENCLAW_VITEST_MAX_WORKERS=2" >> "$GITHUB_ENV" if [ "$TASK" = "test" ]; then echo "OPENCLAW_TEST_PROJECTS_PARALLEL=6" >> "$GITHUB_ENV" + echo "OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD=1" >> "$GITHUB_ENV" fi if [ "$TASK" = "channels" ]; then echo "OPENCLAW_VITEST_MAX_WORKERS=1" >> "$GITHUB_ENV" @@ -946,6 +947,7 @@ jobs: NODE_OPTIONS: --max-old-space-size=6144 # Keep total concurrency predictable on the 32 vCPU runner. OPENCLAW_VITEST_MAX_WORKERS: 1 + OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD: 1 defaults: run: shell: bash diff --git a/scripts/test-projects.test-support.mjs b/scripts/test-projects.test-support.mjs index ae15a96b1c3..6d4f212425d 100644 --- a/scripts/test-projects.test-support.mjs +++ b/scripts/test-projects.test-support.mjs @@ -62,6 +62,7 @@ const EXTENSION_VOICE_CALL_VITEST_CONFIG = "vitest.extension-voice-call.config.t const EXTENSION_WHATSAPP_VITEST_CONFIG = "vitest.extension-whatsapp.config.ts"; const EXTENSION_ZALO_VITEST_CONFIG = "vitest.extension-zalo.config.ts"; const EXTENSIONS_VITEST_CONFIG = "vitest.extensions.config.ts"; +const FULL_EXTENSIONS_VITEST_CONFIG = "vitest.full-extensions.config.ts"; const GATEWAY_VITEST_CONFIG = "vitest.gateway.config.ts"; const HOOKS_VITEST_CONFIG = "vitest.hooks.config.ts"; const INFRA_VITEST_CONFIG = "vitest.infra.config.ts"; @@ -621,6 +622,12 @@ export function buildFullSuiteVitestRunPlans(args, cwd = process.cwd()) { } const expandToProjectConfigs = process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS === "1"; return fullSuiteVitestShards.flatMap((shard) => { + if ( + process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD === "1" && + shard.config === FULL_EXTENSIONS_VITEST_CONFIG + ) { + return []; + } const configs = expandToProjectConfigs ? shard.projects : [shard.config]; return configs.map((config) => ({ config, diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index a5b16b2025f..5a9e7bdd52a 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -196,6 +196,7 @@ describe("scripts/test-projects changed-target routing", () => { describe("scripts/test-projects full-suite sharding", () => { it("splits untargeted runs into fixed shard configs", () => { delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS; + delete process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD; expect(buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config)).toEqual([ "vitest.full-core-unit-fast.config.ts", @@ -213,14 +214,35 @@ describe("scripts/test-projects full-suite sharding", () => { ]); }); + it("can skip the aggregate extension shard when CI runs dedicated extension shards", () => { + const previous = process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD; + process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = "1"; + try { + const configs = buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config); + + expect(configs).not.toContain("vitest.full-extensions.config.ts"); + expect(configs).toContain("vitest.full-auto-reply.config.ts"); + } finally { + if (previous === undefined) { + delete process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD; + } else { + process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = previous; + } + } + }); + it("can expand full-suite shards to project configs for perf experiments", () => { const previous = process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS; process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = "1"; - const plans = buildFullSuiteVitestRunPlans([], process.cwd()); - if (previous === undefined) { - delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS; - } else { - process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = previous; + let plans: ReturnType; + try { + plans = buildFullSuiteVitestRunPlans([], process.cwd()); + } finally { + if (previous === undefined) { + delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS; + } else { + process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = previous; + } } expect(plans.map((plan) => plan.config)).toEqual([ @@ -290,6 +312,31 @@ describe("scripts/test-projects full-suite sharding", () => { ); }); + it("skips extension project configs when leaf sharding and the aggregate extension shard is disabled", () => { + const previousLeafShards = process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS; + const previousSkipExtensions = process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD; + process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = "1"; + process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = "1"; + try { + const configs = buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config); + + expect(configs).not.toContain("vitest.extensions.config.ts"); + expect(configs).not.toContain("vitest.extension-providers.config.ts"); + expect(configs).toContain("vitest.auto-reply-reply.config.ts"); + } finally { + if (previousLeafShards === undefined) { + delete process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS; + } else { + process.env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS = previousLeafShards; + } + if (previousSkipExtensions === undefined) { + delete process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD; + } else { + process.env.OPENCLAW_TEST_SKIP_FULL_EXTENSIONS_SHARD = previousSkipExtensions; + } + } + }); + it("keeps untargeted watch mode on the native root config", () => { expect(buildFullSuiteVitestRunPlans(["--watch"], process.cwd())).toEqual([ {