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): retry SwiftPM binary downloads and wait for the cua-spacesd pin on main builds (#6594)

Francesco Bonacci0b3878bbadb7
diff --git a/.github/actions/swiftpm-resolve/action.yml b/.github/actions/swiftpm-resolve/action.yml
new file mode 100644
index 0000000000..f42dac0f43
--- /dev/null
+++ b/.github/actions/swiftpm-resolve/action.yml
@@ -0,0 +1,33 @@
+name: "Resolve Swift packages (with retries)"
+description: >-
+ Resolve the Cua Spaces SwiftUI app's Swift packages before the build, and
+ retry. Sparkle and Sentry are binary targets that SwiftPM downloads from
+ github.com release URLs; a 504 from GitHub's release CDN failed 2 of the 3
+ red main builds of cd-cua-spaces-build.yml on 5 Nov 2026 after a 60 to 90
+ minute Rust build. `swift build` does not retry a binary target download,
+ so this step does, with a pause, and keeps the downloaded artifacts for the
+ build that follows. Run after actions/checkout, on macOS.
+
+inputs:
+ package-path:
+ description: "Directory of Package.swift."
+ default: apps/cua-spaces-macos
+
+runs:
+ using: composite
+ steps:
+ - name: Resolve Swift packages
+ shell: bash
+ env:
+ PACKAGE_PATH: ${{ github.workspace }}/${{ inputs.package-path }}
+ run: |
+ set -euo pipefail
+ for attempt in 1 2 3 4 5 6; do
+ if swift package --package-path "$PACKAGE_PATH" resolve; then
+ exit 0
+ fi
+ echo "::warning::swift package resolve failed (attempt $attempt of 6); retrying"
+ sleep $((attempt * 30))
+ done
+ echo "::error::swift package resolve failed 6 times (GitHub release downloads)"
+ exit 1
diff --git a/.github/scripts/check_spacesd_published.sh b/.github/scripts/check_spacesd_published.sh
index 375f5f669b..20bbdad9dc 100755
--- a/.github/scripts/check_spacesd_published.sh
+++ b/.github/scripts/check_spacesd_published.sh
@@ -41,10 +41,20 @@ fail() {
exit 1
}
-# The API answers 404 for a draft looked up by tag.
-if ! json="$(gh api "repos/$REPO/releases/tags/$TAG" 2>/dev/null)"; then
- fail "$REPO has no published release $TAG (missing, or still a draft)"
-fi
+# The API answers 404 for a draft looked up by tag. A push to main that bumps
+# libs/cua-spacesd/VERSION starts this check at the same moment as
+# cd-cua-spacesd.yml starts publishing that release (5 Nov 2026: the main
+# build failed on a release that appeared minutes later), so a caller that
+# builds on main can set SPACESD_WAIT_MINUTES to wait for it.
+WAIT_MINUTES="${SPACESD_WAIT_MINUTES:-0}"
+deadline=$(( $(date +%s) + WAIT_MINUTES * 60 ))
+until json="$(gh api "repos/$REPO/releases/tags/$TAG" 2>/dev/null)"; do
+ if [ "$(date +%s)" -ge "$deadline" ]; then
+ fail "$REPO has no published release $TAG (missing, or still a draft)"
+ fi
+ echo "$TAG is not published yet; checking again in 60 s"
+ sleep 60
+done
[ "$(jq -r .draft <<<"$json")" = false ] || fail "$TAG is still a draft"
if [ "$REPO" = trycua/cua ] && [ "$(jq -r .prerelease <<<"$json")" != false ]; then
fail "$TAG is a prerelease; a release build must pin a full cua-spacesd release"
diff --git a/.github/workflows/cd-cua-spaces-build.yml b/.github/workflows/cd-cua-spaces-build.yml
index b7fadd25e3..8e4db9cae6 100644
--- a/.github/workflows/cd-cua-spaces-build.yml
+++ b/.github/workflows/cd-cua-spaces-build.yml
@@ -199,7 +199,7 @@ jobs:
needs: plan
if: needs.plan.outputs.skip != 'true'
runs-on: ubuntu-latest
- timeout-minutes: 10
+ timeout-minutes: 45
permissions:
contents: read
steps:
@@ -207,6 +207,8 @@ jobs:
- name: Check the baked cua-spacesd release
env:
GH_TOKEN: ${{ github.token }}
+ # The VERSION bump and its release publish start together on main.
+ SPACESD_WAIT_MINUTES: "30"
run: .github/scripts/check_spacesd_published.sh "$CUA_RELEASE_REPOSITORY"
# The SwiftUI app's Rust slices, restored from the cache the main producer
@@ -405,6 +407,10 @@ jobs:
name: spaces-web-dist
path: apps/cua-spaces-web/dist
+ # GitHub's release CDN answers 504 for minutes (Sparkle, Sentry binary
+ # targets): resolve with retries before the build that follows the
+ # long Rust compile, so one blip does not cost a whole run.
+ - uses: ./.github/actions/swiftpm-resolve
- name: Build and sign Cua Spaces.app (universal)
env:
SIGNED: ${{ steps.signing.outputs.apple }}
diff --git a/.github/workflows/cd-cua-spaces.yml b/.github/workflows/cd-cua-spaces.yml
index e870fcc00a..84e1723462 100644
--- a/.github/workflows/cd-cua-spaces.yml
+++ b/.github/workflows/cd-cua-spaces.yml
@@ -526,6 +526,10 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: .github/scripts/fetch_static_spacesd.sh "$GITHUB_REPOSITORY" aarch64,x86_64 "$RUNNER_TEMP/static-spacesd"
+ # GitHub's release CDN answers 504 for minutes (Sparkle, Sentry binary
+ # targets): resolve with retries before the build that follows the
+ # long Rust compile, so one blip does not cost a whole run.
+ - uses: ./.github/actions/swiftpm-resolve
- name: Build and sign Cua Spaces.app (universal)
env:
CUA_SPACESD_STATIC_DIR: ${{ runner.temp }}/static-spacesd