ci: collapse preflight manifest routing (#54773)

* ci: collapse preflight manifest routing

* ci: fix preflight workflow outputs

* ci: restore compat workflow tasks

* ci: match macos shards to windows

* ci: collapse macos swift jobs

* ci: skip empty submodule setup

* ci: drop submodule setup from node env
This commit is contained in:
Tak Hoffman
2026-03-25 22:38:30 -05:00
committed by GitHub
parent 4f297a094a
commit 5b68e52894
9 changed files with 877 additions and 360 deletions

View File

@@ -216,6 +216,106 @@ describe("scripts/test-parallel lane planning", () => {
expect(output).toContain("pool=forks");
});
it("prints the planner-backed CI manifest as JSON", () => {
const repoRoot = path.resolve(import.meta.dirname, "../..");
const output = execFileSync("node", ["scripts/test-parallel.mjs", "--ci-manifest"], {
cwd: repoRoot,
env: {
...clearPlannerShardEnv(process.env),
GITHUB_EVENT_NAME: "pull_request",
OPENCLAW_CI_DOCS_ONLY: "false",
OPENCLAW_CI_DOCS_CHANGED: "false",
OPENCLAW_CI_RUN_NODE: "true",
OPENCLAW_CI_RUN_MACOS: "true",
OPENCLAW_CI_RUN_ANDROID: "false",
OPENCLAW_CI_RUN_WINDOWS: "true",
OPENCLAW_CI_RUN_SKILLS_PYTHON: "false",
OPENCLAW_CI_HAS_CHANGED_EXTENSIONS: "false",
OPENCLAW_CI_CHANGED_EXTENSIONS_MATRIX: '{"include":[]}',
},
encoding: "utf8",
});
const manifest = JSON.parse(output);
expect(manifest.jobs.checks.enabled).toBe(true);
expect(manifest.jobs.macosNode.enabled).toBe(true);
expect(manifest.jobs.checksWindows.enabled).toBe(true);
});
it("writes CI workflow outputs in ci mode", () => {
const repoRoot = path.resolve(import.meta.dirname, "../..");
const outputPath = path.join(os.tmpdir(), `openclaw-ci-output-${Date.now()}.txt`);
execFileSync("node", ["scripts/ci-write-manifest-outputs.mjs", "--workflow", "ci"], {
cwd: repoRoot,
env: {
...clearPlannerShardEnv(process.env),
GITHUB_OUTPUT: outputPath,
GITHUB_EVENT_NAME: "pull_request",
OPENCLAW_CI_DOCS_ONLY: "false",
OPENCLAW_CI_DOCS_CHANGED: "false",
OPENCLAW_CI_RUN_NODE: "true",
OPENCLAW_CI_RUN_MACOS: "true",
OPENCLAW_CI_RUN_ANDROID: "true",
OPENCLAW_CI_RUN_WINDOWS: "true",
OPENCLAW_CI_RUN_SKILLS_PYTHON: "false",
OPENCLAW_CI_HAS_CHANGED_EXTENSIONS: "false",
OPENCLAW_CI_CHANGED_EXTENSIONS_MATRIX: '{"include":[]}',
},
encoding: "utf8",
});
const outputs = fs.readFileSync(outputPath, "utf8");
expect(outputs).toContain("run_build_artifacts=true");
expect(outputs).toContain("run_checks_windows=true");
expect(outputs).toContain("run_macos_node=true");
expect(outputs).toContain("android_matrix=");
fs.rmSync(outputPath, { force: true });
});
it("writes install-smoke outputs in install-smoke mode", () => {
const repoRoot = path.resolve(import.meta.dirname, "../..");
const outputPath = path.join(os.tmpdir(), `openclaw-install-output-${Date.now()}.txt`);
execFileSync("node", ["scripts/ci-write-manifest-outputs.mjs", "--workflow", "install-smoke"], {
cwd: repoRoot,
env: {
...clearPlannerShardEnv(process.env),
GITHUB_OUTPUT: outputPath,
OPENCLAW_CI_DOCS_ONLY: "false",
OPENCLAW_CI_RUN_CHANGED_SMOKE: "true",
},
encoding: "utf8",
});
const outputs = fs.readFileSync(outputPath, "utf8");
expect(outputs).toContain("run_install_smoke=true");
expect(outputs).not.toContain("run_checks=");
fs.rmSync(outputPath, { force: true });
});
it("writes bun outputs in ci-bun mode", () => {
const repoRoot = path.resolve(import.meta.dirname, "../..");
const outputPath = path.join(os.tmpdir(), `openclaw-bun-output-${Date.now()}.txt`);
execFileSync("node", ["scripts/ci-write-manifest-outputs.mjs", "--workflow", "ci-bun"], {
cwd: repoRoot,
env: {
...clearPlannerShardEnv(process.env),
GITHUB_OUTPUT: outputPath,
OPENCLAW_CI_DOCS_ONLY: "false",
OPENCLAW_CI_RUN_NODE: "true",
},
encoding: "utf8",
});
const outputs = fs.readFileSync(outputPath, "utf8");
expect(outputs).toContain("run_bun_checks=true");
expect(outputs).toContain("bun_checks_matrix=");
expect(outputs).not.toContain("run_install_smoke=");
fs.rmSync(outputPath, { force: true });
});
it("passes through vitest --mode values that are not wrapper runtime overrides", () => {
const repoRoot = path.resolve(import.meta.dirname, "../..");
const output = execFileSync(

View File

@@ -5,7 +5,11 @@ import {
createExecutionArtifacts,
resolvePnpmCommandInvocation,
} from "../../scripts/test-planner/executor.mjs";
import { buildExecutionPlan, explainExecutionTarget } from "../../scripts/test-planner/planner.mjs";
import {
buildCIExecutionManifest,
buildExecutionPlan,
explainExecutionTarget,
} from "../../scripts/test-planner/planner.mjs";
describe("test planner", () => {
it("builds a capability-aware plan for mid-memory local runs", () => {
@@ -256,6 +260,92 @@ describe("test planner", () => {
artifacts.cleanupTempArtifacts();
expect(fs.existsSync(artifactDir)).toBe(false);
});
it("builds a CI manifest with planner-owned shard counts and matrices", () => {
const manifest = buildCIExecutionManifest(
{
eventName: "pull_request",
docsOnly: false,
docsChanged: false,
runNode: true,
runMacos: true,
runAndroid: true,
runWindows: true,
runSkillsPython: false,
hasChangedExtensions: true,
changedExtensionsMatrix: { include: [{ extension: "discord" }] },
},
{
env: {},
},
);
expect(manifest.jobs.buildArtifacts.enabled).toBe(true);
expect(manifest.shardCounts.unit).toBe(4);
expect(manifest.shardCounts.channels).toBe(3);
expect(manifest.shardCounts.windows).toBe(9);
expect(manifest.shardCounts.macosNode).toBe(9);
expect(manifest.jobs.checks.matrix.include).toHaveLength(7);
expect(manifest.jobs.checksWindows.matrix.include).toHaveLength(9);
expect(manifest.jobs.macosNode.matrix.include).toHaveLength(9);
expect(manifest.jobs.macosSwift.enabled).toBe(true);
expect(manifest.requiredCheckNames).toContain("macos-swift");
expect(manifest.requiredCheckNames).not.toContain("macos-swift-lint");
expect(manifest.requiredCheckNames).not.toContain("macos-swift-build");
expect(manifest.requiredCheckNames).not.toContain("macos-swift-test");
expect(manifest.jobs.extensionFast.matrix.include).toEqual([
{ check_name: "extension-fast-discord", extension: "discord" },
]);
});
it("suppresses heavy CI jobs in docs-only manifests", () => {
const manifest = buildCIExecutionManifest(
{
eventName: "pull_request",
docsOnly: true,
docsChanged: true,
runNode: false,
runMacos: false,
runAndroid: false,
runWindows: false,
runSkillsPython: false,
hasChangedExtensions: false,
},
{
env: {},
},
);
expect(manifest.jobs.buildArtifacts.enabled).toBe(false);
expect(manifest.jobs.checks.enabled).toBe(false);
expect(manifest.jobs.checksWindows.enabled).toBe(false);
expect(manifest.jobs.macosNode.enabled).toBe(false);
expect(manifest.jobs.checkDocs.enabled).toBe(true);
});
it("adds push-only compat and release lanes to push manifests", () => {
const manifest = buildCIExecutionManifest(
{
eventName: "push",
docsOnly: false,
docsChanged: false,
runNode: true,
runMacos: false,
runAndroid: false,
runWindows: false,
runSkillsPython: false,
hasChangedExtensions: false,
},
{
env: {},
},
);
expect(manifest.jobs.releaseCheck.enabled).toBe(true);
expect(
manifest.jobs.checks.matrix.include.some((entry) => entry.task === "compat-node22"),
).toBe(true);
});
});
describe("resolvePnpmCommandInvocation", () => {