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
15 changes: 15 additions & 0 deletions .github/OPENCLAW_CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ test/js/node/process/process.test.js
test/js/bun/sqlite/column-types.test.js
```

## Windows release qualification

The separate [`openclaw-release.yml`](workflows/openclaw-release.yml) keeps
Windows x64 and ARM64 test-only builds, smoke tests and compatibility lanes in
PRs and non-publishing dry runs. Publication defaults to the four Darwin/Linux
targets. The plan job reads `OPENCLAW_RELEASE_WINDOWS_SIGNED` once; only the
exact value `true` enables Windows publication and requires both architectures
with verified Foundation Authenticode signatures. Missing signing configuration
then fails the entire release; unsigned Windows artifacts are never published.

Before enabling the repository variable, configure the Azure OIDC secrets in
`release-signing` with federated credential subject
`repo:openclaw/bun:environment:release-signing`. See
[the release signing instructions](OPENCLAW_RELEASE.md#windows-signing-and-qualification).

## Caches and artifacts

The lane caches the build system's download/prebuilt/ccache directory, Rust
Expand Down
27 changes: 25 additions & 2 deletions .github/OPENCLAW_RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ that already built.
Releases are prereleases and not "latest" while
`vars.OPENCLAW_RELEASE_PRERELEASE` is unset or `true`.

By default, publication includes only `darwin-arm64`, `darwin-x64`, `linux-x64`
and `linux-arm64`. Windows becomes required only when the repository variable
`OPENCLAW_RELEASE_WINDOWS_SIGNED` is exactly `true`. The plan job reads this
switch once and passes it through to manifest validation. With it off, Windows
is neither built for publication nor accepted in the published artifacts.
PRs and non-publishing dry runs still default to all six targets, including
both Windows architectures and their compatibility checks.

Rebuilding a commit that already has a release (a toolchain or pipeline change,
not a source change) gets a new tag with `--rebuild 2` (`…-r2`). Published
assets are never replaced: packagers pin their checksums.
Expand Down Expand Up @@ -237,13 +245,13 @@ costs two more build jobs.

## Windows signing and qualification

Windows x64 and ARM64 are release targets. Both cross-compile on the same Debian
Windows x64 and ARM64 are conditional release targets. Both cross-compile on the same Debian
ARM64 image using clang-cl, lld-link and xwin's MSVC/Windows SDK. Windows ARM64
uses the existing upstream non-LTO lane. Native smoke tests verify source and
engine identity, architecture, SQLite and DFG JIT startup. Both architectures run
the same 29-file Windows compatibility selection and its dependency checks.

Only a publishing run enters the `release-signing` environment and grants the
Only a publishing run with Windows enabled enters the `release-signing` environment and grants the
signing job `id-token: write`. `azure/login` uses the environment secrets
`AZURE_CLIENT_ID`, `AZURE_TENANT_ID` and `AZURE_SUBSCRIPTION_ID` for OIDC.
`azure/artifact-signing-action@v2` uses endpoint
Expand All @@ -259,6 +267,21 @@ receipt to both archives and executables. Missing Azure configuration, failed
signing, an unexpected subject or changed bytes fail the release; there is no
unsigned release fallback.

To enable Windows publication, first configure the `release-signing`
environment's three Azure secrets and the Foundation Artifact Signing account
and certificate profile above. The Azure federated credential subject must be
`repo:openclaw/bun:environment:release-signing`. Then set the repository variable
`OPENCLAW_RELEASE_WINDOWS_SIGNED` to `true`. Both Windows targets become mandatory;
incomplete Azure setup or a failed signature check blocks publication of the
whole release. There is no automatic detection or fallback to unsigned Windows.
Local `plan` and `manifest` commands use the corresponding `--windows-signed`
flag alongside `--publish`.

The manifest schema stays at version 1 in both modes. Consumers project the
available targets into their pins; an absent Windows entry means no Windows
runtime is available from that release. Windows admission still requires a
matching signed entry and never substitutes a Darwin/Linux entry.

PRs and non-publishing dispatches use a separate job without signing credentials
or OIDC permission. Their Windows artifact is named `test-only-windows` and its
manifest records `authenticodeSigned: false` and `testOnly: true`. Production
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/openclaw-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
type: boolean
default: false
targets:
description: "Comma-separated targets; empty = six release targets. Also: linux-x64-musl, linux-arm64-musl"
description: "Comma-separated targets; empty = enabled release targets (all six in dry runs). Also: linux-x64-musl, linux-arm64-musl"
type: string
default: ""

Expand Down Expand Up @@ -50,6 +50,7 @@ jobs:
matrix: ${{ steps.plan.outputs.matrix }}
darwin: ${{ steps.plan.outputs.darwin }}
windows: ${{ steps.plan.outputs.windows }}
windows-signed: ${{ steps.plan.outputs.windows-signed }}
windows-matrix: ${{ steps.plan.outputs.windows-matrix }}
mtime: ${{ steps.plan.outputs.mtime }}
steps:
Expand Down Expand Up @@ -78,10 +79,12 @@ jobs:
id: plan
env:
TARGETS: ${{ inputs.targets }}
WINDOWS_SIGNED: ${{ vars.OPENCLAW_RELEASE_WINDOWS_SIGNED }}
run: |
args=(--source source --main origin/main)
[ -n "$RELEASE_TAG" ] && args+=(--tag "$RELEASE_TAG")
[ "$PUBLISH" = true ] && args+=(--publish)
[ "$WINDOWS_SIGNED" = true ] && args+=(--windows-signed)
[ -n "$TARGETS" ] && args+=(--targets "$TARGETS")
bun pipeline/scripts/openclaw-release/release.ts plan "${args[@]}"

Expand Down Expand Up @@ -477,6 +480,7 @@ jobs:
TAG: ${{ needs.plan.outputs.tag }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
PUBLISH: ${{ needs.plan.outputs.publish }}
WINDOWS_SIGNED: ${{ needs.plan.outputs.windows-signed }}
run: |
revision=""
if [ -f dist/bun-linux-x64.zip ]; then
Expand All @@ -485,6 +489,7 @@ jobs:
fi
args=()
[ "$PUBLISH" = true ] && args+=(--publish)
[ "$WINDOWS_SIGNED" = true ] && args+=(--windows-signed)
bun pipeline/scripts/openclaw-release/release.ts manifest --source source --commit HEAD \
--dist dist --out release --tag "$TAG" --workflow-run "$RUN_URL" ${revision:+--revision "$revision"} "${args[@]}"
cp dist/*.zip release/
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@

- Pin immutable [OpenClaw WebKit `f1e1ca1156`](https://github.com/openclaw/WebKit/releases/tag/autobuild-f1e1ca1156c8cb3b468bec0e1989fbfa08899661) with all ten archive checksums, including Windows ARM64, cached repeated stack coordinates, and the ARM64 allocation-accounting arithmetic fix.
- Account for typed-array and ArrayBuffer payloads before GC, preserve allocation-origin charges across worker transfers, separate external storage from JS heap statistics, and answer worker heap-statistics requests during JavaScript loops and atomic waits. Builds on oven-sh/bun#34406 and oven-sh/WebKit#303; thanks @robobun.

- Publish Darwin/Linux prereleases while Windows signing is unconfigured; require an explicit signed-Windows release switch before including either Windows architecture, while preserving test-only Windows CI.
44 changes: 33 additions & 11 deletions scripts/openclaw-release/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* `.github/workflows/openclaw-release.yml`.
*
* bun scripts/openclaw-release/release.ts tag [--commit <rev>] [--rebuild <n>]
* bun scripts/openclaw-release/release.ts plan [--tag <tag>] [--publish]
* bun scripts/openclaw-release/release.ts plan [--tag <tag>] [--publish] [--windows-signed]
* bun scripts/openclaw-release/release.ts provision --source <dir> --target <t>...
* bun scripts/openclaw-release/release.ts build --source <dir> --target <t> --out <dir>
* bun scripts/openclaw-release/release.ts smoke --zip <zip> --target <t> --commit <sha> --webkit <sha>
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface Target {
exe: string;
/** Sections of the upstream build image's bootstrap.sh this target needs beyond the common toolchain. */
sysroots: readonly string[];
/** Built by a tag push. The others are built only when a dispatch names them. */
/** Eligible for publication; Windows additionally requires the signing switch. */
release: boolean;
/** GitHub-hosted runner (and container) that runs the executable for the smoke test. */
smoke: { runner: string; container?: string };
Expand Down Expand Up @@ -107,9 +107,26 @@ function target(
return { name, os, arch, buildArch, abi, triplet, exe, sysroots, release, smoke };
}

export const releaseTargets: readonly TargetName[] = (Object.keys(targets) as TargetName[]).filter(
name => targets[name].release,
);
export function releaseTargets(windowsSigned = false): TargetName[] {
return (Object.keys(targets) as TargetName[]).filter(
name => targets[name].release && (targets[name].os !== "windows" || windowsSigned),
);
}

function validateReleaseTargets(names: readonly TargetName[], windowsSigned: boolean): void {
if (!windowsSigned && names.some(name => targets[name].os === "windows"))
throw new Error("Windows publication requires --windows-signed");
const required = releaseTargets(windowsSigned);
if (required.some(name => !names.includes(name)))
throw new Error(`a published release has every release target: ${required.join(", ")}`);
}

export function planTargets(list = "", publish = false, windowsSigned = false): TargetName[] {
// Dry runs retain both Windows architectures without needing signing credentials.
const built = list.trim() ? parseTargets(list) : releaseTargets(!publish || windowsSigned);
if (publish) validateReleaseTargets(built, windowsSigned);
return built;
}

/** The workflow's matrix entries. Darwin executables are smoke-tested from the signing job's artifact. */
export function matrix(names: readonly TargetName[], publish = false) {
Expand Down Expand Up @@ -471,6 +488,7 @@ export interface ManifestInput {
signing: Partial<Record<TargetName, Signing>>;
windowsSigning?: Partial<Record<TargetName, WindowsSigning>>;
publish?: boolean;
windowsSigned?: boolean;
}

export const windowsSignerSubject = "CN=OpenClaw Foundation, O=OpenClaw Foundation, L=Mill Valley, S=California, C=US";
Expand Down Expand Up @@ -527,8 +545,12 @@ export function manifest(input: ManifestInput) {
existsSync(join(dist, `${targets[name].triplet}.zip`)),
);
if (!names.length) throw new Error(`no release zips in ${dist}`);
if (input.publish && releaseTargets.some(name => !names.includes(name)))
throw new Error("published manifest must include every release target");
if (input.publish) {
// The workflow uploads every zip, including profile archives without a primary archive.
if (!input.windowsSigned && readdirSync(dist).some(file => /^bun-windows-.*\.zip$/.test(file)))
throw new Error("Windows publication requires --windows-signed");
validateReleaseTargets(names, input.windowsSigned ?? false);
}
const assets = names.map(name => {
const t = targets[name];
const archive = join(dist, `${t.triplet}.zip`);
Expand Down Expand Up @@ -688,6 +710,7 @@ async function main(argv: string[]): Promise<void> {
rebuild: { type: "string" },
tag: { type: "string" },
publish: { type: "boolean", default: false },
"windows-signed": { type: "boolean", default: false },
main: { type: "string", default: "origin/main" },
target: { type: "string", multiple: true },
targets: { type: "string" },
Expand Down Expand Up @@ -728,10 +751,7 @@ async function main(argv: string[]): Promise<void> {
throw new Error(`${facts.commit} is not on ${values.main}; only commits of the fork's main are released`);
}
}
const built = values.targets?.trim() ? parseTargets(values.targets) : [...releaseTargets];
if (values.publish && releaseTargets.some(name => !built.includes(name))) {
throw new Error(`a published release has every release target: ${releaseTargets.join(", ")}`);
}
const built = planTargets(values.targets, values.publish, values["windows-signed"]);
output("matrix", JSON.stringify(matrix(built, values.publish)));
output("darwin", String(built.some(name => targets[name].os === "darwin")));
output("windows", String(built.some(name => targets[name].os === "windows")));
Expand All @@ -750,6 +770,7 @@ async function main(argv: string[]): Promise<void> {
output("version", facts.version);
output("webkit", facts.webkitVersion);
output("publish", String(values.publish));
output("windows-signed", String(values["windows-signed"]));
return;
}
case "provision": {
Expand Down Expand Up @@ -788,6 +809,7 @@ async function main(argv: string[]): Promise<void> {
signing,
windowsSigning,
publish: values.publish,
windowsSigned: values["windows-signed"],
});
mkdirSync(out, { recursive: true });
writeFileSync(join(out, "manifest.json"), JSON.stringify(m, null, 2) + "\n");
Expand Down
81 changes: 77 additions & 4 deletions test/internal/source-lints/openclaw-release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// build works.
import { expect, test } from "bun:test";
import { tempDir } from "harness";
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { generateImage, imageKey, images } from "../../../scripts/build/ci-images/spec.ts";
import { computeBunTriplet } from "../../../scripts/build/ci.ts";
Expand All @@ -16,6 +16,7 @@ import {
matrix,
parseTag,
parseWebkitVersion,
planTargets,
provisionScript,
releaseNotes,
releaseTargets,
Expand Down Expand Up @@ -74,7 +75,8 @@ test("the zips carry upstream's artifact names", () => {
const cfg = { os: t.os, arch: t.buildArch, abi: t.os === "linux" ? t.abi : undefined } as Config;
expect(t.triplet).toBe(computeBunTriplet(cfg));
}
expect(releaseTargets).toEqual([
expect(releaseTargets()).toEqual(["darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"]);
expect(releaseTargets(true)).toEqual([
"darwin-arm64",
"darwin-x64",
"linux-x64",
Expand Down Expand Up @@ -111,11 +113,63 @@ test("the zips carry upstream's artifact names", () => {
]);
});

test("publication requires exactly the enabled platform coverage while dry-run Windows stays test-only", () => {
expect(planTargets("", true)).toEqual(releaseTargets());
expect(planTargets("", true, true)).toEqual(releaseTargets(true));
for (const windowsSigned of [false, true]) {
const required = releaseTargets(windowsSigned);
expect(planTargets(required.join(","), true, windowsSigned)).toEqual(required);
for (const missing of required) {
expect(() => planTargets(required.filter(name => name !== missing).join(","), true, windowsSigned)).toThrow(
"a published release has every release target",
);
}
expect(planTargets("", false, windowsSigned)).toEqual(releaseTargets(true));
const windows = planTargets("windows-x64,windows-arm64", false, windowsSigned);
expect(windows).toEqual(["windows-x64", "windows-arm64"]);
expect(matrix(windows).map(t => t.artifact)).toEqual(["test-only-windows", "test-only-windows"]);
}
for (const name of ["windows-x64", "windows-arm64"]) {
expect(() => planTargets([...releaseTargets(), name].join(","), true)).toThrow(
"Windows publication requires --windows-signed",
);
}
});

test("a default published manifest needs all four Darwin/Linux targets and rejects any Windows archive", () => {
using dir = tempDir("openclaw-unix-manifest", {});
const dist = String(dir);
const file = join(dist, "bun");
writeFileSync(file, "executable");
for (const name of releaseTargets()) {
const t = targets[name];
zip(join(dist, `${t.triplet}.zip`), t.triplet, [file], 1790353014);
}
const input = { tag: tagFor(facts), repository: "openclaw/bun", facts, dist, signing: {}, publish: true };
expect(manifest(input).assets.map(a => a.target)).toEqual(releaseTargets());
expect(() => manifest({ ...input, windowsSigned: true })).toThrow("a published release has every release target");
for (const name of releaseTargets()) {
const archive = join(dist, `${targets[name].triplet}.zip`);
const bytes = readFileSync(archive);
rmSync(archive);
expect(() => manifest(input)).toThrow("a published release has every release target");
writeFileSync(archive, bytes);
}
for (const triplet of ["bun-windows-x64", "bun-windows-aarch64"]) {
for (const suffix of [".zip", "-profile.zip"]) {
const archive = join(dist, `${triplet}${suffix}`);
writeFileSync(archive, "must be rejected before reading unsigned bytes");
expect(() => manifest(input)).toThrow("Windows publication requires --windows-signed");
rmSync(archive);
}
}
});

test("Windows manifest binds signature receipts to final archive and executable bytes", () => {
using dir = tempDir("openclaw-windows-manifest", {});
const dist = String(dir);
const records: Record<string, WindowsSigning> = {};
for (const name of releaseTargets) {
for (const name of releaseTargets(true)) {
const t = targets[name];
const file = join(dist, t.exe);
writeFileSync(file, `${name} executable`);
Expand All @@ -133,14 +187,17 @@ test("Windows manifest binds signature receipts to final archive and executable
profileArchiveSha256: sha256File(join(dist, `${t.triplet}-profile.zip`)),
};
}
const input = { tag: tagFor(facts), repository: "openclaw/bun", facts, dist, signing: {} };
const input = { tag: tagFor(facts), repository: "openclaw/bun", facts, dist, signing: {}, windowsSigned: true };
const unsigned = manifest(input).assets.filter(a => a.os === "windows");
expect(unsigned.map(a => [a.executable.authenticodeSigned, a.executable.testOnly])).toEqual([
[false, true],
[false, true],
]);
expect(() => manifest({ ...input, publish: true })).toThrow("release requires Authenticode");
const signed = manifest({ ...input, windowsSigning: records, publish: true });
expect(() => manifest({ ...input, windowsSigning: records, publish: true, windowsSigned: false })).toThrow(
"Windows publication requires --windows-signed",
);
expect(
signed.assets
.filter(a => a.os === "windows")
Expand All @@ -160,6 +217,22 @@ test("Windows manifest binds signature receipts to final archive and executable
publish: true,
}),
).toThrow("unexpected Authenticode signer");
for (const name of ["windows-x64", "windows-arm64"] as const) {
const archive = join(dist, `${targets[name].triplet}.zip`);
const bytes = readFileSync(archive);
rmSync(archive);
expect(() => manifest({ ...input, windowsSigning: records, publish: true })).toThrow(
"a published release has every release target",
);
writeFileSync(archive, bytes);
expect(() =>
manifest({
...input,
windowsSigning: { ...records, [name]: { ...records[name]!, authenticodeSigned: false } },
publish: true,
}),
).toThrow("release requires Authenticode signing");
}
});

test("the upstream build image still has every section the pipeline provisions", () => {
Expand Down
Loading