Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bun-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.2
6 changes: 3 additions & 3 deletions cli/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"yaml": "2.9.0"
},
"devDependencies": {
"@types/bun": "1.4.0",
"@types/bun": "1.4.2",
"eslint-plugin-no-relative-import-paths": "1.6.1",
"knip": "6.32.2",
"openapi-typescript": "7.13.0",
Expand All @@ -63,5 +63,5 @@
"engines": {
"bun": ">=1.1.0"
},
"packageManager": "bun@1.4.0"
"packageManager": "bun@1.4.2"
}
25 changes: 25 additions & 0 deletions cli/scripts/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
nativeReleaseTarget,
readToolchainContract,
RELEASE_MANIFEST_SCHEMA_VERSION,
darwinSignatureCommand,
signatureVerificationCommand,
stageCommandReferenceAssets,
SUPPORTED_BUN_RUNTIME_RANGE,
writeReleaseMetadata,
Expand Down Expand Up @@ -153,6 +155,29 @@ describe("release target manifest", () => {
"Unsupported native release platform: win32-x64.",
);
});

test("signs and verifies macOS release binaries", () => {
const darwinTarget = RELEASE_TARGETS.find(({ platform }) => platform === "darwin-arm64")!;
const linuxTarget = RELEASE_TARGETS.find(({ platform }) => platform === "linux-arm64")!;
const executable = "/tmp/altertable-test-binary";

expect(darwinSignatureCommand(darwinTarget, executable)).toEqual([
"codesign",
"--force",
"--sign",
"-",
"--timestamp=none",
executable,
]);
expect(signatureVerificationCommand(darwinTarget, executable)).toEqual([
"codesign",
"--verify",
"--strict",
executable,
]);
expect(darwinSignatureCommand(linuxTarget, executable)).toBeUndefined();
expect(signatureVerificationCommand(linuxTarget, executable)).toBeUndefined();
});
});

describe("release toolchain contract", () => {
Expand Down
20 changes: 20 additions & 0 deletions cli/scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,22 @@ export function compileCommand(target: ReleaseTarget, outputPath: string): strin
];
}

export function darwinSignatureCommand(
target: ReleaseTarget,
executable: string,
): string[] | undefined {
if (target.os !== "darwin") return undefined;
return ["codesign", "--force", "--sign", "-", "--timestamp=none", executable];
}

export function signatureVerificationCommand(
target: ReleaseTarget,
executable: string,
): string[] | undefined {
if (target.os !== "darwin") return undefined;
return ["codesign", "--verify", "--strict", executable];
}

export function nativeReleaseTarget(
platform: NodeJS.Platform = process.platform,
architecture: string = process.arch,
Expand All @@ -164,6 +180,8 @@ export async function compileReleaseTarget(
const outputPath = join(outputDirectory, target.asset);
await run(compileCommand(target, outputPath));
await assertNonemptyFile(outputPath);
const signingCommand = darwinSignatureCommand(target, outputPath);
if (signingCommand) await run(signingCommand);
return outputPath;
}

Expand Down Expand Up @@ -387,6 +405,8 @@ export async function smokeReleaseTarget(
): Promise<void> {
const executable = join(outputDirectory, target.asset);
await assertNonemptyFile(executable);
const verifySignature = signatureVerificationCommand(target, executable);
if (verifySignature) await run(verifySignature);
const version = (await runCapture([executable, "--version"])).trim();
if (version !== VERSION) {
throw new Error(`${target.asset} reported version ${version}; expected ${VERSION}.`);
Expand Down