Skip to content

Commit 2424fdf

Browse files
authored
ci: keep native landing validation off queued Blacksmith capacity (#101196)
* ci: route native i18n release gates to hosted runners * ci: keep Testbox PR validation on hosted runners * fix(ci): gate Testbox lifecycle to real leases
1 parent e924f30 commit 2424fdf

4 files changed

Lines changed: 43 additions & 5 deletions

File tree

‎.github/workflows/ci-check-testbox.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ jobs:
3232
permissions:
3333
contents: read
3434
name: "check"
35-
runs-on: blacksmith-32vcpu-ubuntu-2404
35+
# Pull requests only validate the hydration steps; real Testbox leases arrive via dispatch.
36+
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || 'blacksmith-32vcpu-ubuntu-2404' }}
3637
timeout-minutes: ${{ fromJSON(inputs.timeout_minutes || '120') }}
3738
steps:
39+
# Testbox lifecycle actions require Blacksmith VM metadata; PRs validate our setup steps only.
3840
- name: Begin Testbox
41+
if: github.event_name == 'workflow_dispatch'
3942
uses: useblacksmith/begin-testbox@233448af4bfdc6fca509a7f0974411ac6d8a8043
4043
with:
4144
testbox_id: ${{ inputs.testbox_id }}
@@ -177,6 +180,6 @@ jobs:
177180

178181
- name: Run Testbox
179182
uses: useblacksmith/run-testbox@3f60ff9ceb2c10c3feefa87dc0c6490cffae059d
180-
if: always()
183+
if: github.event_name == 'workflow_dispatch' && always()
181184
env:
182185
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ jobs:
846846
contents: read
847847
needs: [preflight]
848848
if: ${{ !cancelled() && always() && needs.preflight.outputs.run_native_i18n == 'true' }}
849-
runs-on: ${{ github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
849+
runs-on: ${{ github.event_name == 'workflow_dispatch' && 'ubuntu-24.04' || (github.repository == 'openclaw/openclaw' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04') }}
850850
timeout-minutes: 10
851851
steps:
852852
- name: Checkout

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ function readBuildArtifactsTestboxWorkflow() {
2121
return parse(readFileSync(".github/workflows/ci-build-artifacts-testbox.yml", "utf8"));
2222
}
2323

24+
function readTestboxWorkflow() {
25+
return parse(readFileSync(".github/workflows/ci-check-testbox.yml", "utf8"));
26+
}
27+
2428
function readWorkflowSanityWorkflow() {
2529
return parse(readFileSync(".github/workflows/workflow-sanity.yml", "utf8"));
2630
}
@@ -119,6 +123,37 @@ describe("ci workflow guards", () => {
119123
expect(readFileSync(".github/workflows/ci.yml", "utf8")).toContain(
120124
"OPENCLAW_CI_RUN_ANDROID: ${{ github.event_name == 'workflow_dispatch' && (inputs.release_gate || inputs.include_android) && 'true' || steps.changed_scope.outputs.run_android || 'false' }}",
121125
);
126+
127+
for (const [jobName, job] of Object.entries(workflow.jobs)) {
128+
const runsOn = (job as { "runs-on"?: unknown })["runs-on"];
129+
if (typeof runsOn !== "string" || !runsOn.includes("blacksmith-")) {
130+
continue;
131+
}
132+
expect(runsOn, `${jobName} must use GitHub-hosted capacity for release gates`).toContain(
133+
"github.event_name == 'workflow_dispatch'",
134+
);
135+
}
136+
});
137+
138+
it("keeps Testbox pull request validation off leased runner capacity", () => {
139+
const workflow = readTestboxWorkflow();
140+
141+
expect(workflow.jobs.check["runs-on"]).toBe(
142+
"${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || 'blacksmith-32vcpu-ubuntu-2404' }}",
143+
);
144+
const beginStep = workflow.jobs.check.steps.find(
145+
(step: { name?: string }) => step.name === "Begin Testbox",
146+
);
147+
const runStep = workflow.jobs.check.steps.find(
148+
(step: { name?: string }) => step.name === "Run Testbox",
149+
);
150+
expect(beginStep).toMatchObject({
151+
if: "github.event_name == 'workflow_dispatch'",
152+
with: { testbox_id: "${{ inputs.testbox_id }}" },
153+
});
154+
expect(runStep).toMatchObject({
155+
if: "github.event_name == 'workflow_dispatch' && always()",
156+
});
122157
});
123158

124159
it("pins every external GitHub Action reference to a full commit SHA", () => {

‎test/scripts/package-acceptance-workflow.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ describe("package artifact reuse", () => {
13001300
).toHaveLength(4);
13011301
});
13021302

1303-
it("finalizes Testbox delegation even when setup or the remote command fails", () => {
1303+
it("finalizes dispatched Testbox delegation even when setup or the remote command fails", () => {
13041304
const workflow = readFileSync(CI_CHECK_TESTBOX_WORKFLOW, "utf8");
13051305
const checkTestboxJob = workflowJob(CI_CHECK_TESTBOX_WORKFLOW, "check");
13061306
const runTestboxStep = workflowStep(checkTestboxJob, "Run Testbox");
@@ -1324,7 +1324,7 @@ describe("package artifact reuse", () => {
13241324
"${{ fromJSON(inputs.timeout_minutes || '120') }}",
13251325
);
13261326
expect(runTestboxStep.uses).toContain("useblacksmith/run-testbox@");
1327-
expect(runTestboxStep.if).toBe("always()");
1327+
expect(runTestboxStep.if).toBe("github.event_name == 'workflow_dispatch' && always()");
13281328
expect(runArmTestboxStep.if).toBe("always()");
13291329
expect(runBuildArtifactsTestboxStep.if).toBe("always()");
13301330
expect(runWindowsTestboxStep.if).toBe("always()");

0 commit comments

Comments
 (0)