mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 18:42:25 +00:00
fix(crabbox): preflight macOS Swift toolchain
This commit is contained in:
@@ -962,6 +962,111 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
|
||||
expectGroupedShellCommand(remoteCommand, "node --version");
|
||||
});
|
||||
|
||||
it("preflights Swift 6.2 for raw AWS macOS Swift app builds", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
[
|
||||
"run",
|
||||
"--provider",
|
||||
"aws",
|
||||
"--target",
|
||||
"macos",
|
||||
"--",
|
||||
"swift",
|
||||
"build",
|
||||
"--package-path",
|
||||
"apps/macos",
|
||||
"--product",
|
||||
"OpenClaw",
|
||||
],
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.args).toContain("--shell");
|
||||
expect(remoteCommand).toContain("openclaw_crabbox_require_macos_swift_62");
|
||||
expect(remoteCommand).toContain("/Applications/Xcode_26.1.app");
|
||||
expect(remoteCommand).toContain("/Applications/Xcode-26*.app");
|
||||
expect(remoteCommand).toContain('sudo xcode-select -s "$openclaw_developer"');
|
||||
expect(remoteCommand).toContain("OpenClaw macOS app proof requires Swift tools 6.2+");
|
||||
expect(remoteCommand).not.toContain("openclaw_crabbox_bootstrap_macos_js");
|
||||
expectGroupedShellCommand(
|
||||
remoteCommand,
|
||||
"swift build --package-path apps/macos --product OpenClaw",
|
||||
);
|
||||
});
|
||||
|
||||
it("preflights Swift and JS tooling for raw AWS macOS package scripts", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--target", "macos", "--", "pnpm", "mac:package"],
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.args).toContain("--shell");
|
||||
expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_macos_js");
|
||||
expect(remoteCommand).toContain("pnpm --version >&2");
|
||||
expect(remoteCommand).toContain("openclaw_crabbox_require_macos_swift_62");
|
||||
expect(remoteCommand).toContain("OpenClaw macOS app proof requires Swift tools 6.2+");
|
||||
expectGroupedShellCommand(remoteCommand, "pnpm mac:package");
|
||||
});
|
||||
|
||||
it("preserves sanitized env pnpm package commands when Swift preflight is needed", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--target", "macos", "--", "env", "-i", "pnpm", "mac:package"],
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.args).toContain("--shell");
|
||||
expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_macos_js");
|
||||
expect(remoteCommand).toContain("openclaw_crabbox_require_macos_swift_62");
|
||||
expectGroupedShellCommand(remoteCommand, "openclaw_crabbox_env -i pnpm mac:package");
|
||||
});
|
||||
|
||||
it("preflights Swift for raw AWS macOS shell-launched package scripts", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--target", "macos", "--", "bash", "scripts/package-mac-app.sh"],
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.args).toContain("--shell");
|
||||
expect(remoteCommand).toContain("openclaw_crabbox_require_macos_swift_62");
|
||||
expect(remoteCommand).not.toContain("openclaw_crabbox_bootstrap_macos_js");
|
||||
expectGroupedShellCommand(remoteCommand, "bash scripts/package-mac-app.sh");
|
||||
});
|
||||
|
||||
it("does not preflight Swift for raw AWS macOS commands that only mention package scripts", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--target", "macos", "--", "echo", "scripts/package-mac-app.sh"],
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.args).not.toContain("--shell");
|
||||
expect(output.args).toEqual([
|
||||
"run",
|
||||
"--provider",
|
||||
"aws",
|
||||
"--target",
|
||||
"macos",
|
||||
"--market",
|
||||
"on-demand",
|
||||
"--",
|
||||
"echo",
|
||||
"scripts/package-mac-app.sh",
|
||||
]);
|
||||
});
|
||||
|
||||
it("normalizes inherited Linux UTF-8 locale names for raw AWS macOS bootstrap", () => {
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
@@ -1545,6 +1650,43 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
|
||||
expect(output.scriptContent).toContain(`\n${script}\n`);
|
||||
});
|
||||
|
||||
it("preflights Swift for AWS macOS script-stdin Swift builds", () => {
|
||||
const script = [
|
||||
"set -euo pipefail",
|
||||
"swift build --package-path apps/macos --product OpenClaw",
|
||||
].join("\n");
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--target", "macos", "--script-stdin"],
|
||||
{ input: script },
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.scriptContent).toContain("openclaw_crabbox_bootstrap_macos_js");
|
||||
expect(output.scriptContent).toContain("openclaw_crabbox_require_macos_swift_62");
|
||||
expect(output.scriptContent).toContain("openclaw_crabbox_require_macos_swift_62 || exit $?");
|
||||
expect(output.scriptContent).toContain("OpenClaw macOS app proof requires Swift tools 6.2+");
|
||||
expect(output.scriptContent).toContain(`\n${script}`);
|
||||
});
|
||||
|
||||
it("preflights Swift and JS for AWS macOS script-stdin package scripts", () => {
|
||||
const script = ["#!/usr/bin/env bash", "set -euo pipefail", "pnpm mac:package"].join("\n");
|
||||
const result = runWrapper(
|
||||
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
|
||||
["run", "--provider", "aws", "--target", "macos", "--script-stdin"],
|
||||
{ input: script },
|
||||
);
|
||||
|
||||
const output = parseFakeCrabboxOutput(result);
|
||||
expect(result.status).toBe(0);
|
||||
expect(output.scriptContent).toContain("openclaw_crabbox_bootstrap_macos_js");
|
||||
expect(output.scriptContent).toContain("pnpm --version >&2");
|
||||
expect(output.scriptContent).toContain("openclaw_crabbox_require_macos_swift_62");
|
||||
expect(output.scriptContent).toContain("openclaw_crabbox_require_macos_swift_62 || exit $?");
|
||||
expect(output.scriptContent).toContain(`\n${script}\n`);
|
||||
});
|
||||
|
||||
it("bootstraps Corepack for AWS macOS script-stdin env shebangs with option values", () => {
|
||||
const script = ["#!/usr/bin/env -C /tmp -u OPENCLAW_FAKE_VAR pnpm", "--version"].join("\n");
|
||||
const result = runWrapper(
|
||||
|
||||
Reference in New Issue
Block a user