diff --git a/.github/OPENCLAW_CI.md b/.github/OPENCLAW_CI.md index 43741a63cf84..f6110a0a2f93 100644 --- a/.github/OPENCLAW_CI.md +++ b/.github/OPENCLAW_CI.md @@ -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 diff --git a/.github/OPENCLAW_RELEASE.md b/.github/OPENCLAW_RELEASE.md index 442570035006..86866a172a9a 100644 --- a/.github/OPENCLAW_RELEASE.md +++ b/.github/OPENCLAW_RELEASE.md @@ -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. @@ -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 @@ -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 diff --git a/.github/workflows/openclaw-release.yml b/.github/workflows/openclaw-release.yml index 8a913ac45a6d..0253accda952 100644 --- a/.github/workflows/openclaw-release.yml +++ b/.github/workflows/openclaw-release.yml @@ -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: "" @@ -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: @@ -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[@]}" @@ -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 @@ -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/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 36cb2d273247..3cb7079c0849 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/scripts/openclaw-release/release.ts b/scripts/openclaw-release/release.ts index a0c67a2f8743..2cb466464523 100644 --- a/scripts/openclaw-release/release.ts +++ b/scripts/openclaw-release/release.ts @@ -6,7 +6,7 @@ * `.github/workflows/openclaw-release.yml`. * * bun scripts/openclaw-release/release.ts tag [--commit ] [--rebuild ] - * bun scripts/openclaw-release/release.ts plan [--tag ] [--publish] + * bun scripts/openclaw-release/release.ts plan [--tag ] [--publish] [--windows-signed] * bun scripts/openclaw-release/release.ts provision --source --target ... * bun scripts/openclaw-release/release.ts build --source --target --out * bun scripts/openclaw-release/release.ts smoke --zip --target --commit --webkit @@ -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 }; @@ -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) { @@ -471,6 +488,7 @@ export interface ManifestInput { signing: Partial>; windowsSigning?: Partial>; publish?: boolean; + windowsSigned?: boolean; } export const windowsSignerSubject = "CN=OpenClaw Foundation, O=OpenClaw Foundation, L=Mill Valley, S=California, C=US"; @@ -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`); @@ -688,6 +710,7 @@ async function main(argv: string[]): Promise { 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" }, @@ -728,10 +751,7 @@ async function main(argv: string[]): Promise { 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"))); @@ -750,6 +770,7 @@ async function main(argv: string[]): Promise { output("version", facts.version); output("webkit", facts.webkitVersion); output("publish", String(values.publish)); + output("windows-signed", String(values["windows-signed"])); return; } case "provision": { @@ -788,6 +809,7 @@ async function main(argv: string[]): Promise { signing, windowsSigning, publish: values.publish, + windowsSigned: values["windows-signed"], }); mkdirSync(out, { recursive: true }); writeFileSync(join(out, "manifest.json"), JSON.stringify(m, null, 2) + "\n"); diff --git a/test/internal/source-lints/openclaw-release.test.ts b/test/internal/source-lints/openclaw-release.test.ts index 543c4faeb78f..a59d95d85a89 100644 --- a/test/internal/source-lints/openclaw-release.test.ts +++ b/test/internal/source-lints/openclaw-release.test.ts @@ -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"; @@ -16,6 +16,7 @@ import { matrix, parseTag, parseWebkitVersion, + planTargets, provisionScript, releaseNotes, releaseTargets, @@ -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", @@ -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 = {}; - 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`); @@ -133,7 +187,7 @@ 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], @@ -141,6 +195,9 @@ test("Windows manifest binds signature receipts to final archive and executable ]); 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") @@ -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", () => {