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.

ci(spaces): beta builds are production builds, drop build-release.sh --channel (CUA-2115) (#5801)

Francesco Bonaccif9b74afd3b8e
diff --git a/.github/actions/spaces-rust-slice/action.yml b/.github/actions/spaces-rust-slice/action.yml
index 81e80ca8c1..36243da054 100644
--- a/.github/actions/spaces-rust-slice/action.yml
+++ b/.github/actions/spaces-rust-slice/action.yml
@@ -82,7 +82,8 @@ runs:
working-directory: libs/cua
env:
CARGO_BUILD_JOBS: 4
- # build-release.sh's stable channel (--channel is not passed).
+ # Release builds, betas included, default to production
+ # (build-release.sh sets the same empty default).
CUA_DEFAULT_ENV: ""
TRIPLE: ${{ inputs.triple }}
run: cargo build --locked --release -p cua-spaces-ffi -p cua-spaces-cli --target "$TRIPLE"
diff --git a/.github/workflows/cd-cua-spaces.yml b/.github/workflows/cd-cua-spaces.yml
index 2a0da3ec33..97d08129c4 100644
--- a/.github/workflows/cd-cua-spaces.yml
+++ b/.github/workflows/cd-cua-spaces.yml
@@ -25,7 +25,10 @@ name: "CD: Cua Spaces"
# item is the notarized DMG of a release, EdDSA-signed by Sparkle's
# generate_appcast (apps/cua-spaces-macos/scripts/make-appcast.sh, checked
# by verify-appcast.sh). X.Y.Z-suffix versions go to the `beta` channel
-# (apps set to "Update to: Beta"). Only with the CUA_SPACES_SPARKLE_ED_PRIVATE_KEY
+# (apps set to "Update to: Beta"). A beta is a production build with a
+# prerelease version, not a staging build: it is built exactly like a stable
+# release, so it talks to production (CUA_ENV=staging at launch selects
+# staging for any build). Only with the CUA_SPACES_SPARKLE_ED_PRIVATE_KEY
# secret and a Developer ID build: without it no appcast is made or
# published and every other step is unchanged. The macOS job writes the
# appcast (merged into the published one) as a workflow artifact; the last
@@ -499,7 +502,8 @@ jobs:
identity="-"
[ "$SIGNED" = true ] && identity="Developer ID Application: $DEVELOPER_NAME ($TEAM_ID)"
# The updater's feed is this repository's (staging updates from
- # staging).
+ # staging). Stable and beta versions are built the same way, and
+ # production is the build default.
apps/cua-spaces-macos/scripts/build-release.sh --version "$VERSION" \
--build-number "$GITHUB_RUN_NUMBER" --arch universal --skip-cargo \
--sign "$identity" --out "$RUNNER_TEMP/spaces-app" \
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TargetEnvironment.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TargetEnvironment.swift
index 90020f686e..3acf06b0a9 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TargetEnvironment.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TargetEnvironment.swift
@@ -7,9 +7,9 @@ import Foundation
/// `staging`). The SDK resolves every endpoint from it. The app only settles
/// it before anything starts:
///
-/// - `CUA_ENV` unset: the bundle's `CuaEnv` Info.plist value, which a beta
-/// channel build sets to `staging` (`scripts/build-release.sh` with
-/// `CUA_CHANNEL=beta`); release builds have none (production);
+/// - `CUA_ENV` unset: the bundle's `CuaEnv` Info.plist value, which a
+/// development build can set to `staging`; release builds, betas included,
+/// have none (`scripts/build-release.sh` removes it), so they use production;
/// - `CUA_HOME` unset under staging: `~/.cua/envs/staging`, so the daemon it
/// supervises and every file it reads use the same home as the SDK.
public enum TargetEnvironment {
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TargetEnvironmentTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TargetEnvironmentTests.swift
index 046df594fb..6e231fd3e5 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TargetEnvironmentTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TargetEnvironmentTests.swift
@@ -5,8 +5,9 @@
import Foundation
import Testing
-/// `CUA_ENV`: production changes nothing; staging gets its own home; a beta
-/// build's bundle default applies only when `CUA_ENV` is unset.
+/// `CUA_ENV`: production changes nothing; staging gets its own home; a
+/// bundle's `CuaEnv` default (a development build can set it) applies only when
+/// `CUA_ENV` is unset.
@Suite("Target environment")
struct TargetEnvironmentTests {
@Test func productionChangesNothing() {
@@ -21,7 +22,7 @@ struct TargetEnvironmentTests {
.isEmpty)
}
- @Test func betaBundleDefaultsToStaging() {
+ @Test func bundleDefaultStagingAppliesWhenCuaEnvIsUnset() {
#expect(TargetEnvironment.pinned(env: [:], bundleEnv: "staging", home: "/Users/ada")
== ["CUA_ENV": "staging", "CUA_HOME": "/Users/ada/.cua/envs/staging"])
}
diff --git a/apps/cua-spaces-macos/scripts/build-release.sh b/apps/cua-spaces-macos/scripts/build-release.sh
index 9fcdc66bbe..01aa8a0338 100755
--- a/apps/cua-spaces-macos/scripts/build-release.sh
+++ b/apps/cua-spaces-macos/scripts/build-release.sh
@@ -25,14 +25,18 @@
#
# scripts/build-release.sh --version 0.2.0[-suffix] [--build-number N]
# [--arch universal|arm64|x86_64] [--sign IDENTITY] [--out DIR]
-# [--feed-url URL] [--channel stable|beta] [--skip-cargo]
+# [--feed-url URL] [--skip-cargo]
#
-# --channel beta builds the beta channel: it talks to Cua staging by default
-# (Info.plist CuaEnv=staging, and the bundled cua is compiled with
-# CUA_DEFAULT_ENV=staging), with a staging session and home
-# (~/.cua/envs/staging). CUA_ENV=prod at launch still selects production.
-# stable (the default) is production. With --skip-cargo, build the reused
-# binaries with CUA_DEFAULT_ENV=staging yourself.
+# Every release build, a beta included, is a production build: it talks to
+# Cua production unless CUA_ENV=staging is set at launch. The script keeps
+# the build default empty: no CuaEnv in Info.plist, and the Rust build runs
+# with CUA_DEFAULT_ENV empty (with --skip-cargo, the reused binaries must
+# have been built that way, as the release workflow's slices are). A beta
+# (--version X.Y.Z-suffix) is the same build with a prerelease version:
+# scripts/make-appcast.sh puts its item on Sparkle's beta channel, so only
+# apps set to "Update to: Beta" are offered it, and they keep their
+# production session and home. A build that defaults to staging is a local
+# build, not a release.
#
# --feed-url sets the updater's appcast (SUFeedURL; default Support/Info.plist's,
# trycua/cua's rolling cua-spaces-latest release). The release workflow passes
@@ -65,7 +69,6 @@ identity="-"
out="$here/.build/release-app"
skip_cargo=0
feed_url=""
-channel=stable
while [ $# -gt 0 ]; do
case "$1" in
--version) version="$2"; shift ;;
@@ -75,7 +78,6 @@ while [ $# -gt 0 ]; do
--out) out="$2"; shift ;;
--skip-cargo) skip_cargo=1 ;;
--feed-url) feed_url="$2"; shift ;;
- --channel) channel="$2"; shift ;;
-h | --help) sed -n '5,45p' "$0"; exit 0 ;;
*) echo "unknown option: $1" >&2; exit 2 ;;
esac
@@ -101,18 +103,13 @@ case "$arch" in
arm64 | x86_64) archs="$arch" ;;
*) echo "--arch must be universal, arm64 or x86_64" >&2; exit 2 ;;
esac
-case "$channel" in
- stable) default_env="" ;;
- beta) default_env=staging ;;
- *) echo "--channel must be stable or beta" >&2; exit 2 ;;
-esac
triple() { [ "$1" = arm64 ] && echo aarch64-apple-darwin || echo x86_64-apple-darwin; }
target="${CARGO_TARGET_DIR:-$cua/target}"
case "$target" in /*) ;; *) target="$cua/$target" ;; esac
if [ "$skip_cargo" = 0 ]; then
for a in $archs; do
- (cd "$cua" && CUA_DEFAULT_ENV="$default_env" cargo build --locked --release -p cua-spaces-ffi -p cua-spaces-cli --target "$(triple "$a")")
+ (cd "$cua" && CUA_DEFAULT_ENV="" cargo build --locked --release -p cua-spaces-ffi -p cua-spaces-cli --target "$(triple "$a")")
done
fi
@@ -157,10 +154,8 @@ plist="$app/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bundle_version" "$plist"
/usr/libexec/PlistBuddy -c "Delete :CuaVersion" "$plist" 2>/dev/null || true
/usr/libexec/PlistBuddy -c "Add :CuaVersion string $version" "$plist"
+# A release never defaults to staging.
/usr/libexec/PlistBuddy -c "Delete :CuaEnv" "$plist" 2>/dev/null || true
-if [ -n "$default_env" ]; then
- /usr/libexec/PlistBuddy -c "Add :CuaEnv string $default_env" "$plist"
-fi
if [ -n "$feed_url" ]; then
case "$feed_url" in https://*) ;; *) echo "--feed-url must be https" >&2; exit 2 ;; esac
/usr/libexec/PlistBuddy -c "Set :SUFeedURL $feed_url" "$plist"
diff --git a/docs/content/docs/cua-cli/guides/authentication.mdx b/docs/content/docs/cua-cli/guides/authentication.mdx
index b83c1cde41..1a216ab223 100644
--- a/docs/content/docs/cua-cli/guides/authentication.mdx
+++ b/docs/content/docs/cua-cli/guides/authentication.mdx
@@ -89,8 +89,8 @@ events go to the staging PostHog project, never to production's.
`CUA_POSTHOG_KEY` overrides the project key, and `CUA_TELEMETRY_ENDPOINT`
overrides the ingest URL.
-Beta builds of `cua` and the Cua Spaces app use staging when `CUA_ENV` is unset.
-`CUA_ENV=prod` still selects production in a beta build.
+Released builds of `cua` and the Cua Spaces app, beta versions included, use
+production when `CUA_ENV` is unset. Set `CUA_ENV=staging` to use staging.
To open the macOS app against staging, quit the production app first, then
launch it with the variable set: