diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58449b1eedb..949729fefc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,6 +243,7 @@ jobs: task: "test-shard", shard_name: shard.shardName, configs: shard.configs, + requires_dist: shard.requiresDist, })) : [], ), @@ -425,11 +426,18 @@ jobs: - name: Build Control UI run: pnpm ui:build + - name: Cache dist build + uses: actions/cache@v5 + with: + path: dist/ + key: ${{ runner.os }}-dist-build-${{ github.sha }} + - name: Upload dist artifact uses: actions/upload-artifact@v7 with: name: dist-build path: dist/ + compression-level: 0 retention-days: 1 - name: Upload A2UI bundle artifact @@ -640,7 +648,16 @@ jobs: - name: Configure Node test resources run: echo "OPENCLAW_VITEST_MAX_WORKERS=2" >> "$GITHUB_ENV" + - name: Restore dist cache + id: dist-cache + if: matrix.requires_dist == true + uses: actions/cache@v5 + with: + path: dist/ + key: ${{ runner.os }}-dist-build-${{ github.sha }} + - name: Download dist artifact + if: matrix.requires_dist == true && steps.dist-cache.outputs.cache-hit != 'true' uses: actions/download-artifact@v8 with: name: dist-build @@ -988,8 +1005,16 @@ jobs: install-bun: "false" use-sticky-disk: "false" - - name: Download dist artifact + - name: Restore dist cache + id: build-smoke-dist-cache if: github.event_name == 'push' + uses: actions/cache@v5 + with: + path: dist/ + key: ${{ runner.os }}-dist-build-${{ github.sha }} + + - name: Download dist artifact + if: github.event_name == 'push' && steps.build-smoke-dist-cache.outputs.cache-hit != 'true' uses: actions/download-artifact@v8 with: name: dist-build diff --git a/scripts/lib/ci-node-test-plan.mjs b/scripts/lib/ci-node-test-plan.mjs index 205b6427207..ac1520931ee 100644 --- a/scripts/lib/ci-node-test-plan.mjs +++ b/scripts/lib/ci-node-test-plan.mjs @@ -7,6 +7,11 @@ const EXCLUDED_FULL_SUITE_SHARDS = new Set([ ]); const EXCLUDED_PROJECT_CONFIGS = new Set(["test/vitest/vitest.channels.config.ts"]); +const DIST_DEPENDENT_NODE_SHARD_NAMES = new Set([ + "core-support-boundary", + "core-runtime", + "agentic", +]); function formatNodeTestShardCheckName(shardName) { const normalizedShardName = shardName.startsWith("core-unit-") @@ -31,6 +36,7 @@ export function createNodeTestShards() { checkName: formatNodeTestShardCheckName(shard.name), shardName: shard.name, configs, + requiresDist: DIST_DEPENDENT_NODE_SHARD_NAMES.has(shard.name), }, ]; }); diff --git a/test/scripts/ci-node-test-plan.test.ts b/test/scripts/ci-node-test-plan.test.ts index 4dca9c1e108..16e7fe49c04 100644 --- a/test/scripts/ci-node-test-plan.test.ts +++ b/test/scripts/ci-node-test-plan.test.ts @@ -24,4 +24,12 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => { expect(configs).not.toContain("test/vitest/vitest.full-extensions.config.ts"); expect(configs).not.toContain("test/vitest/vitest.extension-telegram.config.ts"); }); + + it("marks only dist-dependent shards for built artifact restore", () => { + const requiresDistShardNames = createNodeTestShards() + .filter((shard) => shard.requiresDist) + .map((shard) => shard.shardName); + + expect(requiresDistShardNames).toEqual(["core-support-boundary", "core-runtime", "agentic"]); + }); });