Skip to content

Commit f2ee4c5

Browse files
committed
fix(ci): support frozen target tooling
1 parent b85a049 commit f2ee4c5

2 files changed

Lines changed: 91 additions & 22 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,11 @@ jobs:
18711871
# A missing startup asset rebuild must finish before any verifier forks
18721872
# so concurrent readers never observe dist mid-write.
18731873
startup_assets=success
1874-
node --import tsx scripts/ensure-cli-startup-build.mts || startup_assets=failure
1874+
startup_builder=(node --import tsx scripts/ensure-cli-startup-build.mts)
1875+
if [[ ! -f scripts/ensure-cli-startup-build.mts ]]; then
1876+
startup_builder=(node scripts/ensure-cli-startup-build.mjs)
1877+
fi
1878+
"${startup_builder[@]}" || startup_assets=failure
18751879
18761880
# Hosted runners keep the remaining verifiers serial; Blacksmith
18771881
# overlaps them with the selected checks below.
@@ -2966,11 +2970,18 @@ jobs:
29662970
shell: bash
29672971
run: |
29682972
set -euo pipefail
2969-
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
2970-
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
2973+
if [[ -f scripts/prepare-extension-package-boundary-artifacts.mts ]]; then
2974+
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
2975+
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
2976+
echo "enabled=true" >> "$GITHUB_OUTPUT"
2977+
else
2978+
# Older targets build this boundary through their candidate-owned
2979+
# runner, but cannot produce the v2 cache fingerprint safely.
2980+
echo "enabled=false" >> "$GITHUB_OUTPUT"
2981+
fi
29712982
29722983
- name: Cache extension package boundary artifacts for hosted lint
2973-
if: needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')
2984+
if: needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')
29742985
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
29752986
with:
29762987
path: |
@@ -2987,7 +2998,7 @@ jobs:
29872998
# the shared sticky. Strictly read-only (commit: false): only the
29882999
# protected boundary lane may publish this repository-global snapshot.
29893000
- name: Mount extension boundary sticky disk
2990-
if: matrix.task == 'lint' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3001+
if: matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
29913002
uses: useblacksmith/stickydisk@35ba2e331a80056a42af053ee54968511de2b7c7 # v1.5.0
29923003
with:
29933004
# One stable disk for the whole repository. The v1 per-PR/per-config
@@ -3000,7 +3011,7 @@ jobs:
30003011
commit: "false"
30013012

30023013
- name: Restore extension boundary artifacts from sticky disk
3003-
if: matrix.task == 'lint' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3014+
if: matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
30043015
shell: bash
30053016
run: |
30063017
set -euo pipefail
@@ -3141,7 +3152,11 @@ jobs:
31413152
lint_args=(--threads=1)
31423153
export GOMAXPROCS=2
31433154
fi
3144-
if [ "$RUN_CONTROL_UI_I18N" = "true" ] || [ "$RUN_UI_TESTS" = "true" ]; then
3155+
if [[ ! -f scripts/run-oxlint-shards.mts ]]; then
3156+
# The candidate's older shard runner owns all three source
3157+
# groups; do not split core stripes it cannot represent.
3158+
pnpm lint
3159+
elif [ "$RUN_CONTROL_UI_I18N" = "true" ] || [ "$RUN_UI_TESTS" = "true" ]; then
31453160
pnpm lint "${lint_args[@]}"
31463161
else
31473162
echo "[skip] changed scope cannot affect control-UI i18n catalogs"
@@ -3292,9 +3307,16 @@ jobs:
32923307
env:
32933308
GOMAXPROCS: "2"
32943309
OPENCLAW_LOCAL_CHECK: "0"
3295-
run: >-
3296-
node --import tsx scripts/run-oxlint-shards.mts
3297-
--only=core --split-core --core-stripe=${{ matrix.stripe }}/5 --threads=1
3310+
run: |
3311+
set -euo pipefail
3312+
# Older candidates run their complete lint set in check-lint; their
3313+
# runner predates core-stripe, so these five new-only jobs are redundant.
3314+
if [[ ! -f scripts/run-oxlint-shards.mts ]]; then
3315+
echo "[skip] target does not support core lint stripes"
3316+
exit 0
3317+
fi
3318+
node --import tsx scripts/run-oxlint-shards.mts \
3319+
--only=core --split-core --core-stripe=${{ matrix.stripe }}/5 --threads=1
32983320
32993321
# The github/hybrid planner profile stripes the 14 serial core test-type
33003322
# graphs (~34-42s per graph on either runner class; tsgo saturates a machine
@@ -3423,16 +3445,23 @@ jobs:
34233445
shell: bash
34243446
run: |
34253447
set -euo pipefail
3426-
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
3427-
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
3448+
if [[ -f scripts/prepare-extension-package-boundary-artifacts.mts ]]; then
3449+
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
3450+
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
3451+
echo "enabled=true" >> "$GITHUB_OUTPUT"
3452+
else
3453+
# Older targets build this boundary through their candidate-owned
3454+
# runner, but cannot produce the v2 cache fingerprint safely.
3455+
echo "enabled=false" >> "$GITHUB_OUTPUT"
3456+
fi
34283457
34293458
# Same-repo runs carry boundary artifacts on a Blacksmith sticky disk:
34303459
# the GitHub cache below is evicted so quickly under the repo quota that
34313460
# its prefix restore never hits, leaving every run to rebuild ~113s of
34323461
# plugin-sdk declarations. Fork PRs must never produce writable
34333462
# repository-global snapshots, so they keep the GitHub cache path.
34343463
- name: Mount extension boundary sticky disk
3435-
if: matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3464+
if: matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
34363465
uses: useblacksmith/stickydisk@35ba2e331a80056a42af053ee54968511de2b7c7 # v1.5.0
34373466
with:
34383467
# One stable disk for the whole repository. The v1 per-PR/per-config
@@ -3453,7 +3482,7 @@ jobs:
34533482

34543483
- name: Restore extension boundary artifacts from sticky disk
34553484
id: boundary-sticky-restore
3456-
if: matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3485+
if: matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
34573486
shell: bash
34583487
run: |
34593488
set -euo pipefail
@@ -3482,7 +3511,7 @@ jobs:
34823511
34833512
- name: Cache extension package boundary artifacts
34843513
id: extension-package-boundary-cache
3485-
if: needs.preflight.outputs.cache_mode != 'off' && matrix.group == 'extension-package-boundary'
3514+
if: needs.preflight.outputs.cache_mode != 'off' && matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true'
34863515
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
34873516
with:
34883517
path: |
@@ -3495,7 +3524,7 @@ jobs:
34953524
${{ runner.os }}-extension-package-boundary-v2-
34963525
34973526
- name: Preserve extension package boundary cache hit
3498-
if: matrix.group == 'extension-package-boundary' && steps.extension-package-boundary-cache.outputs.cache-hit == 'true'
3527+
if: matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true' && steps.extension-package-boundary-cache.outputs.cache-hit == 'true'
34993528
shell: bash
35003529
run: |
35013530
set -euo pipefail
@@ -3655,7 +3684,7 @@ jobs:
36553684
# clone). Seed the payload before the sticky post-action flushes.
36563685
# rsync -aR mirrors the repo-relative layout the restore step replays.
36573686
- name: Seed extension boundary sticky disk
3658-
if: success() && steps.boundary-sticky-restore.outputs.restored == 'false' && matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request' && github.repository == 'openclaw/openclaw'
3687+
if: success() && steps.extension-boundary-inputs.outputs.enabled == 'true' && steps.boundary-sticky-restore.outputs.restored == 'false' && matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request' && github.repository == 'openclaw/openclaw'
36593688
shell: bash
36603689
run: |
36613690
set -euo pipefail
@@ -3898,10 +3927,18 @@ jobs:
38983927
# Linux owns the full repo test suite. Keep the Windows runner focused on
38993928
# Windows-native process/path wrappers so platform regressions fail fast.
39003929
test-1)
3901-
pnpm test:windows:ci:1
3930+
if node -e 'process.exit(require("./package.json").scripts?.["test:windows:ci:1"] ? 0 : 1)'; then
3931+
pnpm test:windows:ci:1
3932+
else
3933+
pnpm test:windows:ci
3934+
fi
39023935
;;
39033936
test-2)
3904-
pnpm test:windows:ci:2
3937+
if node -e 'process.exit(require("./package.json").scripts?.["test:windows:ci:2"] ? 0 : 1)'; then
3938+
pnpm test:windows:ci:2
3939+
else
3940+
echo "[skip] target's combined Windows suite ran in test-1"
3941+
fi
39053942
;;
39063943
*)
39073944
echo "Unsupported Windows checks task: $TASK" >&2

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3190,8 +3190,10 @@ NODE
31903190
label,
31913191
).toEqual(expectedWindowsMatrix);
31923192
}
3193-
expect(runStep.run).toContain("test-1)\n pnpm test:windows:ci:1");
3194-
expect(runStep.run).toContain("test-2)\n pnpm test:windows:ci:2");
3193+
expect(runStep.run).toContain('scripts?.["test:windows:ci:1"]');
3194+
expect(runStep.run).toContain('scripts?.["test:windows:ci:2"]');
3195+
expect(runStep.run).toContain("pnpm test:windows:ci");
3196+
expect(runStep.run).toContain("target's combined Windows suite ran in test-1");
31953197
expect(runStep.run).not.toContain("pnpm test:windows:ci:3");
31963198
});
31973199

@@ -5310,7 +5312,10 @@ server.listen(0, "127.0.0.1", () => {
53105312
expect(gate.if).toContain("vars.OPENCLAW_CI_RUNNER_BACKEND != 'github'");
53115313
}
53125314
expect(hostedLintCache.if).toBe(
5313-
"needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')",
5315+
"needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')",
5316+
);
5317+
expect(boundaryCache.if).toBe(
5318+
"needs.preflight.outputs.cache_mode != 'off' && matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true'",
53145319
);
53155320
expect(hostedLintCache.uses).toBe(CACHE_V5);
53165321
expect(hostedLintCache.with).toEqual(boundaryCache.with);
@@ -5331,6 +5336,7 @@ server.listen(0, "127.0.0.1", () => {
53315336
expect(step.run).toContain(
53325337
"scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint",
53335338
);
5339+
expect(step.run).toContain('echo "enabled=false" >> "$GITHUB_OUTPUT"');
53345340
}
53355341
expect(fingerprintSteps[0]?.run).toBe(fingerprintSteps[1]?.run);
53365342
// Single semantic writer: protected pushes commit explicitly (not
@@ -8960,6 +8966,12 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
89608966

89618967
expect(buildChecks.run).toContain("pnpm test:gateway:watch-regression -- --skip-build");
89628968
expect(buildChecks.run).not.toContain("scripts/check-gateway-watch-regression.mts");
8969+
expect(buildChecks.run).toContain(
8970+
"startup_builder=(node --import tsx scripts/ensure-cli-startup-build.mts)",
8971+
);
8972+
expect(buildChecks.run).toContain(
8973+
"startup_builder=(node scripts/ensure-cli-startup-build.mjs)",
8974+
);
89638975
expect(qaBuild.run.match(/pnpm build qaRuntime/gu)).toHaveLength(1);
89648976
expect(qaBuild.run).not.toContain("package-openclaw-for-docker");
89658977
expect(additionalChecks.run).toContain(
@@ -8974,6 +8986,26 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
89748986
expect(additionalChecks.run).not.toContain(
89758987
"if [ ! -f scripts/check-session-transcript-reader-boundary.mts ]",
89768988
);
8989+
const checkLint = workflow.jobs["check-shard"].steps.find(
8990+
(step: WorkflowStep) => step.name === "Run check shard",
8991+
);
8992+
const hostedCoreLint = workflow.jobs["check-lint-hosted-core-shard"].steps.find(
8993+
(step: WorkflowStep) => step.name === "Run hosted core lint stripe",
8994+
);
8995+
const lintBoundaryFingerprint = workflow.jobs["check-shard"].steps.find(
8996+
(step: WorkflowStep) => step.name === "Compute extension boundary input fingerprint",
8997+
);
8998+
const additionalBoundaryFingerprint = workflow.jobs["check-additional-shard"].steps.find(
8999+
(step: WorkflowStep) => step.name === "Compute extension boundary input fingerprint",
9000+
);
9001+
9002+
// The frozen candidate owns the older full lint and boundary builders;
9003+
// current-only stripe and cache mechanics must not replace that coverage.
9004+
expect(checkLint.run).toContain("if [[ ! -f scripts/run-oxlint-shards.mts ]]; then");
9005+
expect(checkLint.run).toContain("pnpm lint");
9006+
expect(hostedCoreLint.run).toContain("target does not support core lint stripes");
9007+
expect(lintBoundaryFingerprint.run).toContain("enabled=false");
9008+
expect(additionalBoundaryFingerprint.run).toContain("enabled=false");
89779009
});
89789010

89799011
it("emits one final CI gate after every selected lane", () => {

0 commit comments

Comments
 (0)