Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
ci(macos): PRs reuse main's Rust build cache (CUA-3094) (#6317)
cua-agents[bot]7371bb14a456
diff --git a/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py b/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.pyindex bd9fb53992..ea2cb30462 100644--- a/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py+++ b/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py@@ -49,8 +49,11 @@ def test_every_swift_check_still_runs_in_exactly_one_job():def test_the_library_is_compiled_once_and_downloaded_by_the_rest():+ # The build is the spaces-rust-slice action's (restore main's library or+ # build it); no other job compiles it.builders = [n for n in JOBS if "cargo build" in run_text(n) and "cua-spaces-ffi" in run_text(n)]- assert builders == ["ffi"]+ assert builders == []+ assert [n for n in JOBS if "./.github/actions/spaces-rust-slice" in uses(n)] == ["ffi"]for name in SWIFT_JOBS:job = JOBS[name]assert job["needs"] == "ffi", name@@ -84,23 +87,21 @@ def test_release_please_pull_requests_still_skip_the_macos_jobs():assert "release-please--branches--" in JOBS["core"]["if"]-def test_ffi_takes_main_slice_only_by_restoring_it():+def test_ffi_reuses_main_slice_or_builds_on_main_dependency_cache():steps = {s.get("id"): s for s in JOBS["ffi"]["steps"] if s.get("id")}slice_step = steps["slice"]assert slice_step["uses"] == "./.github/actions/spaces-rust-slice"- assert slice_step["with"] == {"triple": "aarch64-apple-darwin", "build": "false"}+ # Default build: an exact key hit restores main's library; a miss builds+ # with the producer's command on top of main's Swatinem dependency cache+ # (never a separate `cargo build` of this job's own, which missed it).+ assert slice_step["with"] == {"triple": "aarch64-apple-darwin"}assert JOBS["ffi"]["env"]["CUA_RELEASE_REPOSITORY"] == "${{ github.repository }}"- # Every compile step is for the miss path only.- for step in JOBS["ffi"]["steps"]:- if step.get("name") in ("Install Rust (toolchain from rust-toolchain.toml)", "Install protoc",- "Build the Cua Spaces app library") or step.get("uses") == "./.github/actions/rust-cache":- assert step["if"] == "steps.slice.outputs.cache-hit != 'true'", step- copy = next(s for s in JOBS["ffi"]["steps"] if s.get("name") == "Use the restored library")- assert copy["if"] == "steps.slice.outputs.cache-hit == 'true'"+ assert "./.github/actions/rust-cache" not in uses("ffi")+ copy = next(s for s in JOBS["ffi"]["steps"] if s.get("name") == "Stage the library where the Swift jobs expect it")assert "target/aarch64-apple-darwin/release/libcua_spaces_ffi.dylib" in copy["run"]-def test_only_ffi_saves_the_sccache_family_on_main():+def test_only_the_bindings_job_restores_the_sccache_family():rust_cache = [s for s in JOBS["bindings"]["steps"] if s.get("uses") == "./.github/actions/rust-cache"]assert len(rust_cache) == 1 and rust_cache[0]["with"]["save-if"] == "false"for name in ("swift-tests", "app-bundle"):diff --git a/.github/workflows/ci-cua-spaces-macos.yml b/.github/workflows/ci-cua-spaces-macos.ymlindex 677dd00243..031a1f355c 100644--- a/.github/workflows/ci-cua-spaces-macos.yml+++ b/.github/workflows/ci-cua-spaces-macos.yml@@ -140,36 +140,24 @@ jobs:CUA_RELEASE_REPOSITORY: ${{ github.repository }}steps:- uses: actions/checkout@v4- # Restore only: main compiled this exact Rust input tree when it merged- # (ci-cua-spaces-rust-slice.yml) unless the pull request changes it.- - name: Restore main's compiled library for these Rust inputs+ # One definition of the build, shared with the producer on main+ # (ci-cua-spaces-rust-slice.yml). Exact key hit (the pull request leaves+ # the Rust inputs as they are on main): main's compiled library, seconds.+ # Miss: the action builds with the same `--target` command and the same+ # Swatinem cache family main saves, so a pull request compiles only the+ # workspace crates it changed (minutes) and not the whole dependency tree+ # (73 minutes cold). The old miss path built `cargo build --release`+ # without `--target`, into a different target directory and an sccache+ # family warmed by debug test builds, so it never reused main's work.+ - name: Restore main's compiled library, or build on top of main's dependency cacheid: sliceuses: ./.github/actions/spaces-rust-slicewith:triple: aarch64-apple-darwin- build: "false"- - name: Use the restored library- if: steps.slice.outputs.cache-hit == 'true'+ - name: Stage the library where the Swift jobs expect itrun: |mkdir -p libs/cua/target/releasecp libs/cua/target/aarch64-apple-darwin/release/libcua_spaces_ffi.dylib libs/cua/target/release/- - name: Install Rust (toolchain from rust-toolchain.toml)- if: steps.slice.outputs.cache-hit != 'true'- working-directory: libs/cua- run: rustup show active-toolchain || rustup toolchain install- - name: Install protoc- if: steps.slice.outputs.cache-hit != 'true'- uses: ./.github/actions/setup-protoc- - uses: ./.github/actions/rust-cache- if: steps.slice.outputs.cache-hit != 'true'- with:- workspaces: libs/cua- # The Cua Spaces app export (libcua_spaces_ffi, which carries the cua- # SDK too); each Swift job stages it as libs/cua/swift/lib/libcua_sdk.dylib.- - name: Build the Cua Spaces app library- if: steps.slice.outputs.cache-hit != 'true'- working-directory: libs/cua- run: cargo build --locked --release -p cua-spaces-ffi- name: Upload the library for the Swift jobsuses: actions/upload-artifact@v4with:@@ -267,7 +255,7 @@ jobs:run: rustup show active-toolchain || rustup toolchain install- name: Install protocuses: ./.github/actions/setup-protoc- # Restore only: `ffi` is the job that saves this family on main.+ # Restore only (main's other macOS jobs save this family).- uses: ./.github/actions/rust-cachewith:workspaces: libs/cuadiff --git a/.github/workflows/ci-infinite-canvas-swift.yml b/.github/workflows/ci-infinite-canvas-swift.ymlindex 0f13f4360e..1880708b06 100644--- a/.github/workflows/ci-infinite-canvas-swift.yml+++ b/.github/workflows/ci-infinite-canvas-swift.yml@@ -93,7 +93,11 @@ jobs:- uses: ./.github/actions/rust-cachewith:workspaces: libs/cua- key: infinite-canvas-swift+ # Its own family: this job builds `--release -p cua-sdk`, whose units+ # the default libs-cua family (debug test builds) does not hold, so+ # every run compiled the SDK tree cold (25 minutes). Pushes to main+ # save this family; pull requests restore it.+ shared-key: libs-cua-sdk-release-macos- name: Build and stage the cua SDK for Swiftrun: |(cd libs/cua && cargo build --locked --release -p cua-sdk)