Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(spaces): build and sign the Electron Windows app in the release (#4927)

ddupont7af0ec0abede
diff --git a/.github/workflows/cd-cua-spaces.yml b/.github/workflows/cd-cua-spaces.yml
index abbb63c723..4b3042d6dd 100644
--- a/.github/workflows/cd-cua-spaces.yml
+++ b/.github/workflows/cd-cua-spaces.yml
@@ -1137,7 +1137,10 @@ jobs:
ENDPOINT: ${{ vars.AZURE_ARTIFACT_SIGNING_ENDPOINT }}
ACCOUNT: ${{ vars.AZURE_ARTIFACT_SIGNING_ACCOUNT_NAME }}
PROFILE: ${{ vars.AZURE_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME }}
- PUBLISHER: ${{ vars.AZURE_ARTIFACT_SIGNING_PUBLISHER_NAME }}
+ # The certificate's CN (electron-builder requires it with
+ # azureSignOptions; electron-updater accepts only installers signed
+ # by it): the Azure profile's, Cua AI, Inc., unless the variable says.
+ PUBLISHER: ${{ vars.AZURE_ARTIFACT_SIGNING_PUBLISHER_NAME || 'Cua AI, Inc.' }}
run: |
set -euo pipefail
if [ "$SIGNED" = true ]; then
diff --git a/apps/cua-spaces-desktop/electron-builder.config.cjs b/apps/cua-spaces-desktop/electron-builder.config.cjs
index aa52bce723..cd1fb1d9d1 100644
--- a/apps/cua-spaces-desktop/electron-builder.config.cjs
+++ b/apps/cua-spaces-desktop/electron-builder.config.cjs
@@ -19,9 +19,9 @@
// AZURE_SIGNING_ENDPOINT e.g. https://eus.codesigning.azure.net
// AZURE_SIGNING_ACCOUNT signing account name
// AZURE_SIGNING_PROFILE certificate profile name
-// AZURE_SIGNING_PUBLISHER optional: the certificate's CN; when set,
-// electron-updater accepts only installers
-// signed by it
+// AZURE_SIGNING_PUBLISHER the certificate's CN (electron-builder
+// requires it); electron-updater accepts only
+// installers signed by it
//
// Native layer: every package needs `pnpm native -- --target <triple>` for
// its arch first (both mac triples for universal); `afterPack` refuses a
@@ -112,6 +112,9 @@ const macNotarize =
const archs = (platform, all) => packageArchs(platform, all, env.CUA_SPACES_ARCHS);
const azureSigning = ["AZURE_SIGNING_ENDPOINT", "AZURE_SIGNING_ACCOUNT", "AZURE_SIGNING_PROFILE"].every((k) => env[k]);
+if (azureSigning && !env.AZURE_SIGNING_PUBLISHER) {
+ throw new Error("AZURE_SIGNING_PUBLISHER (the signing certificate's CN, e.g. Cua AI, Inc.) is required with Azure signing");
+}
/**
* The native layer of the arch being packed (`pnpm native`): the
@@ -232,7 +235,7 @@ module.exports = {
endpoint: env.AZURE_SIGNING_ENDPOINT,
codeSigningAccountName: env.AZURE_SIGNING_ACCOUNT,
certificateProfileName: env.AZURE_SIGNING_PROFILE,
- ...(env.AZURE_SIGNING_PUBLISHER ? { publisherName: env.AZURE_SIGNING_PUBLISHER } : {}),
+ publisherName: env.AZURE_SIGNING_PUBLISHER,
},
}
: {}),
diff --git a/apps/cua-spaces-desktop/test/vault-identity.test.ts b/apps/cua-spaces-desktop/test/vault-identity.test.ts
index 9db494642f..3cdb07ef01 100644
--- a/apps/cua-spaces-desktop/test/vault-identity.test.ts
+++ b/apps/cua-spaces-desktop/test/vault-identity.test.ts
@@ -104,7 +104,7 @@ describe("the Linux policy", () => {
describe("the Windows daemon's signature", () => {
const configPath = require.resolve("../electron-builder.config.cjs");
- const azure = { AZURE_SIGNING_ENDPOINT: "https://eus.codesigning.azure.net", AZURE_SIGNING_ACCOUNT: "acct", AZURE_SIGNING_PROFILE: "profile" };
+ const azure = { AZURE_SIGNING_ENDPOINT: "https://eus.codesigning.azure.net", AZURE_SIGNING_ACCOUNT: "acct", AZURE_SIGNING_PROFILE: "profile", AZURE_SIGNING_PUBLISHER: "Cua AI, Inc." };
/** The config as CI loads it with `env`. */
function load(env: Record<string, string>) {
diff --git a/apps/cua-spaces-web/scripts/build-core-wasm.mjs b/apps/cua-spaces-web/scripts/build-core-wasm.mjs
index 4da1f15d76..a8bf2c8f25 100644
--- a/apps/cua-spaces-web/scripts/build-core-wasm.mjs
+++ b/apps/cua-spaces-web/scripts/build-core-wasm.mjs
@@ -19,7 +19,7 @@
import { spawnSync } from "node:child_process"
import { existsSync, mkdirSync, realpathSync } from "node:fs"
import { homedir } from "node:os"
-import { dirname, join, resolve } from "node:path"
+import { delimiter, dirname, join, resolve } from "node:path"
import { fileURLToPath } from "node:url"
const app = resolve(dirname(fileURLToPath(import.meta.url)), "..")
@@ -43,11 +43,17 @@ function give_up(message) {
// rustup's proxies and cargo-installed tools first, so the toolchain the
// libs pin (apps/cua-spaces/rust-toolchain.toml, found upward from the
-// crate) is used even when a Homebrew rust is earlier on PATH.
+// crate) is used even when a Homebrew rust is earlier on PATH. On Windows
+// `sh` (Git Bash) answers with a POSIX path (`/c/Users/...`) that Node
+// cannot resolve, and rustup's proxies are in ~/.cargo/bin anyway.
const extra = [join(homedir(), ".cargo", "bin")]
-const rustup = spawnSync("sh", ["-c", "command -v rustup"], { encoding: "utf8" }).stdout?.trim()
-if (rustup) extra.unshift(dirname(realpathSync(rustup)))
-const env = { ...process.env, CARGO_TARGET_DIR: target, PATH: [...extra, process.env.PATH].join(":") }
+if (process.platform !== "win32") {
+ const rustup = spawnSync("sh", ["-c", "command -v rustup"], { encoding: "utf8" }).stdout?.trim()
+ if (rustup && existsSync(rustup)) extra.unshift(dirname(realpathSync(rustup)))
+}
+// Windows names the variable `Path`; set the one the environment has.
+const pathKey = Object.keys(process.env).find((k) => k.toUpperCase() === "PATH") ?? "PATH"
+const env = { ...process.env, CARGO_TARGET_DIR: target, [pathKey]: [...extra, process.env[pathKey]].join(delimiter) }
function run(cmd, args) {
const r = spawnSync(cmd, args, { cwd: crate, stdio: "inherit", env })