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(cd): pass universal binary to notarization script via CUA_DRIVER_PREBUILT_BINARY (#1494)

dduponta68f8155aaa9
diff --git a/.github/workflows/cd-swift-cua-driver.yml b/.github/workflows/cd-swift-cua-driver.yml
index 218df6b8ad..2b6951aede 100644
--- a/.github/workflows/cd-swift-cua-driver.yml
+++ b/.github/workflows/cd-swift-cua-driver.yml
@@ -177,28 +177,22 @@ jobs:
lipo -create "$ARM64_BIN" "$X86_BIN" -output .build/cua-driver-universal
lipo -info .build/cua-driver-universal
- # The notarization script builds from source; we'll inject the
- # universal binary into the .app after the script runs.
- # First, run the script to get the signed .app structure.
+ # Pass the universal binary to the notarization script so it is
+ # embedded in the .app (and therefore the tarballs) from the start.
+ # Without this the script rebuilds arm64-only from source, packages
+ # it into the tarball, and the post-hoc binary swap comes too late.
+ export CUA_DRIVER_PREBUILT_BINARY="$(pwd)/.build/cua-driver-universal"
+
chmod +x scripts/build/build-release-notarized.sh
cd scripts/build
LOG_LEVEL=minimal ./build-release-notarized.sh
# Return from libs/cua-driver/scripts/build back to libs/cua-driver
cd ../..
- # Replace the single-arch binary inside the .app with the universal one.
+ echo "Verifying universal binary in packaged .app..."
APP_BINARY=".release/CuaDriver.app/Contents/MacOS/cua-driver"
if [ -f "$APP_BINARY" ]; then
- cp .build/cua-driver-universal "$APP_BINARY"
- # Re-sign the binary (the .app is already signed; we need to
- # re-sign just the binary slice we replaced).
- codesign --force --sign "$CERT_APPLICATION_NAME" \
- --options runtime \
- --entitlements scripts/build/entitlements.plist \
- "$APP_BINARY" || true
- echo "Universal binary injected and re-signed."
- else
- echo "Warning: app binary not found at $APP_BINARY — using architecture-specific release."
+ lipo -info "$APP_BINARY"
fi
echo "Files in .release directory:"
diff --git a/libs/cua-driver/scripts/build/build-release-notarized.sh b/libs/cua-driver/scripts/build/build-release-notarized.sh
index 667e2e6a05..4202a94ce3 100755
--- a/libs/cua-driver/scripts/build/build-release-notarized.sh
+++ b/libs/cua-driver/scripts/build/build-release-notarized.sh
@@ -60,9 +60,16 @@ cd "$CUA_DRIVER_DIR"
mkdir -p .release
log "normal" "Ensuring .release directory exists and is accessible"
-# Build the release version
-log "essential" "Building release version..."
-swift build -c release --product cua-driver > /dev/null
+# Build or use a prebuilt binary (e.g. a pre-lipo'd universal binary from CI).
+# Set CUA_DRIVER_PREBUILT_BINARY to an absolute path to skip swift build entirely.
+if [ -n "${CUA_DRIVER_PREBUILT_BINARY:-}" ]; then
+ log "essential" "Using prebuilt binary: $CUA_DRIVER_PREBUILT_BINARY"
+ BUILT_BINARY="$CUA_DRIVER_PREBUILT_BINARY"
+else
+ log "essential" "Building release version..."
+ swift build -c release --product cua-driver > /dev/null
+ BUILT_BINARY=".build/release/cua-driver"
+fi
# --- Assemble .app bundle ---
log "essential" "Assembling .app bundle..."
@@ -73,7 +80,7 @@ mkdir -p "$APP_BUNDLE/Contents/MacOS"
mkdir -p "$APP_BUNDLE/Contents/Resources"
# Copy the binary into the bundle
-cp -f .build/release/cua-driver "$APP_BUNDLE/Contents/MacOS/cua-driver"
+cp -f "$BUILT_BINARY" "$APP_BUNDLE/Contents/MacOS/cua-driver"
# Stamp and copy Info.plist — the source plist ships with a static
# `CFBundleShortVersionString` for dev builds; substitute the release