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(cua-sdk): ship CLI and installer feed without waiting on xcframework (CUA-1771) (#5314)

Francesco Bonaccibfefa5835200
diff --git a/.github/workflows/cd-cua-sdk.yml b/.github/workflows/cd-cua-sdk.yml
index f501e06d54..27c0a15b57 100644
--- a/.github/workflows/cd-cua-sdk.yml
+++ b/.github/workflows/cd-cua-sdk.yml
@@ -5,7 +5,8 @@ name: "CD: cua SDK"
# - platform wheels of PyPI `cua` (linux x86_64/aarch64 with the
# glibc 2.31 floor from debian:11, macOS arm64/x86_64, Windows x64/arm64),
# - `@trycua/cua` + six optional native npm packages (+ the browser build),
-# - `CuaSDKFFI.xcframework.zip` for the Swift `.binaryTarget`,
+# - `CuaSDKFFI.xcframework.zip` for the Swift `.binaryTarget` (attached by
+# attach-xcframework after the release is out; it never blocks the CLI),
# - the `cua` CLI binaries, plus standalone `cua-cli-<version>-<platform>`
# archives, checksums.txt and release-artifacts.json for install.sh /
# install.ps1 (also mirrored to the rolling `cua-install-latest` release).
@@ -385,6 +386,10 @@ jobs:
xcframework:
needs: version
runs-on: macos-26
+ # A normal build takes 80-100 min (iOS + macOS slices). Nothing waits on
+ # it except attach-xcframework, so the CLI, registries and installer feed
+ # ship without it.
+ timeout-minutes: 150
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install protoc
@@ -412,7 +417,9 @@ jobs:
if-no-files-found: error
publish:
- needs: [version, wheels, npm, xcframework, native]
+ # Not xcframework: the Swift build is slow and must never hold back the
+ # CLI or the installer feed. attach-xcframework adds it to the release.
+ needs: [version, wheels, npm, native]
if: needs.version.outputs.publish == 'true'
runs-on: ubuntu-latest
permissions:
@@ -484,10 +491,6 @@ jobs:
run: |
mkdir -p release
cp dist/wheel-*/*.whl dist/npm/*.tgz release/
- # upload-artifact keeps the paths below the files' common root.
- xcframework="$(find dist/xcframework -name CuaSDKFFI.xcframework.zip)"
- [ "$(printf '%s\n' "$xcframework" | grep -c .)" = 1 ] || { echo "expected one CuaSDKFFI.xcframework.zip, got: $xcframework" >&2; exit 1; }
- cp "$xcframework" release/
for d in dist/native-*; do
label="${d##*/native-}"
tar -czf "release/cua-${{ needs.version.outputs.version }}-$label.tar.gz" -C "$d" .
@@ -582,3 +585,37 @@ jobs:
python3 scripts/install/stamp_installers.py --repo "$GITHUB_REPOSITORY" --out stamped
gh release upload cua-install-latest release-artifacts.json \
stamped/install.sh stamped/install.ps1 --clobber --repo "$GITHUB_REPOSITORY"
+
+ # The Swift package's CuaSDKFFI.xcframework.zip joins the already-published
+ # release when its build finishes; checksums.txt is rewritten to include it.
+ attach-xcframework:
+ needs: [version, xcframework, publish]
+ if: needs.version.outputs.publish == 'true'
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ permissions:
+ contents: write
+ id-token: write
+ steps:
+ - uses: actions/download-artifact@v4
+ with:
+ name: xcframework
+ path: dist/xcframework
+ - uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
+ - name: Attach CuaSDKFFI.xcframework.zip to the release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ TAG: ${{ needs.version.outputs.tag }}
+ run: |
+ set -euo pipefail
+ mkdir -p release
+ # upload-artifact keeps the paths below the files' common root.
+ xcframework="$(find dist/xcframework -name CuaSDKFFI.xcframework.zip)"
+ [ "$(printf '%s\n' "$xcframework" | grep -c .)" = 1 ] || { echo "expected one CuaSDKFFI.xcframework.zip, got: $xcframework" >&2; exit 1; }
+ cp "$xcframework" release/
+ cosign sign-blob --yes --bundle release/CuaSDKFFI.xcframework.zip.sigstore.json \
+ release/CuaSDKFFI.xcframework.zip >/dev/null
+ gh release download "$TAG" --pattern checksums.txt --dir previous --repo "$GITHUB_REPOSITORY"
+ (cd release && sha256sum -- CuaSDKFFI.xcframework.zip CuaSDKFFI.xcframework.zip.sigstore.json) > new.txt
+ grep -v ' CuaSDKFFI\.xcframework\.zip' previous/checksums.txt | cat - new.txt | sort > release/checksums.txt
+ gh release upload "$TAG" release/* --clobber --repo "$GITHUB_REPOSITORY"