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-driver): run whole platform unit suites on their OS (#4097)

Francesco Bonacci4757bcea4389
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 6bc72f2ec5..96142979b7 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -26,6 +26,7 @@
/.github/workflows/ci-distro-compat-cua-driver.yml @f-trycua @injaneity
/.github/workflows/ci-rust-format.yml @f-trycua @injaneity
/.github/workflows/ci-rust-linux.yml @f-trycua @injaneity
+/.github/workflows/ci-rust-macos.yml @f-trycua @injaneity
/.github/workflows/ci-rust-windows.yml @f-trycua @injaneity
/.github/workflows/clawhub-cua-driver.yml @f-trycua @injaneity
/.github/workflows/e2e-rust-linux-wayland.yml @f-trycua @injaneity
diff --git a/.github/workflows/ci-rust-macos.yml b/.github/workflows/ci-rust-macos.yml
new file mode 100644
index 0000000000..c5e5c128b0
--- /dev/null
+++ b/.github/workflows/ci-rust-macos.yml
@@ -0,0 +1,60 @@
+name: "CI: Rust macOS unit"
+
+on:
+ pull_request:
+ paths:
+ - "libs/cua-driver/rust/.cargo/**"
+ - "libs/cua-driver/rust/Cargo.toml"
+ - "libs/cua-driver/rust/Cargo.lock"
+ - "libs/cua-driver/rust/rust-toolchain.toml"
+ - "libs/cua-driver/rust/crates/cua-driver-contract/**"
+ - "libs/cua-driver/rust/crates/cua-driver-core/**"
+ - "libs/cua-driver/rust/crates/cursor-overlay/**"
+ - "libs/cua-driver/rust/crates/pip-preview/**"
+ - "libs/cua-driver/rust/crates/platform-macos/**"
+ - ".github/workflows/ci-rust-macos.yml"
+ push:
+ branches: [main]
+ paths:
+ - "libs/cua-driver/rust/.cargo/**"
+ - "libs/cua-driver/rust/Cargo.toml"
+ - "libs/cua-driver/rust/Cargo.lock"
+ - "libs/cua-driver/rust/rust-toolchain.toml"
+ - "libs/cua-driver/rust/crates/cua-driver-contract/**"
+ - "libs/cua-driver/rust/crates/cua-driver-core/**"
+ - "libs/cua-driver/rust/crates/cursor-overlay/**"
+ - "libs/cua-driver/rust/crates/pip-preview/**"
+ - "libs/cua-driver/rust/crates/platform-macos/**"
+ - ".github/workflows/ci-rust-macos.yml"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ci-rust-macos-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ unit:
+ name: Rust macOS unit
+ runs-on: macos-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
+ - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 # 1.97.1
+ - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
+ with:
+ workspaces: "libs/cua-driver/rust -> target"
+ shared-key: macos-unit
+ save-if: ${{ github.ref == 'refs/heads/main' }}
+ # Run each crate's whole inline suite so new test modules cannot be
+ # silently left out by a hand-maintained filter list. Tests that need a
+ # logged-in, TCC-authorized desktop are #[ignore] and belong to the Lume
+ # harness (libs/cua-driver/tests/runners/macos-lume/run-all.sh).
+ - name: Run platform-macos unit tests
+ working-directory: libs/cua-driver/rust
+ run: cargo test --locked -p platform-macos --lib
+ - name: Run cua-driver-core unit tests on macOS
+ working-directory: libs/cua-driver/rust
+ run: cargo test --locked -p cua-driver-core --lib
diff --git a/.github/workflows/ci-rust-windows.yml b/.github/workflows/ci-rust-windows.yml
index a1ca38facc..6b10a50eaa 100644
--- a/.github/workflows/ci-rust-windows.yml
+++ b/.github/workflows/ci-rust-windows.yml
@@ -90,19 +90,11 @@ jobs:
cargo test -p cua-driver --bin cua-driver $test --locked -- --exact
if ($LASTEXITCODE -ne 0) { throw "Extension manager security regression $test failed with exit $LASTEXITCODE" }
}
- - name: Run deferred text publication regressions
+ # Run the whole inline suite so new platform-windows test modules cannot
+ # be silently left out by a hand-maintained module filter list.
+ - name: Run platform-windows unit tests
working-directory: libs/cua-driver/rust
- run: |
- cargo test -p platform-windows post_message_readback_tests:: --lib --locked
- if ($LASTEXITCODE -ne 0) { throw "PostMessage read-back tests failed with exit $LASTEXITCODE" }
- cargo test -p platform-windows value_write_readback_tests:: --lib --locked
- if ($LASTEXITCODE -ne 0) { throw "ValuePattern read-back tests failed with exit $LASTEXITCODE" }
- - name: Run pixel click transport regressions
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows pixel_click_transport_tests:: --lib --locked"
- - name: Run bounded UIA worker regressions
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows windows_enum::tests:: --lib --locked"
+ run: cargo test --locked -p platform-windows --lib
- name: Run MCP proxy lifecycle regressions
working-directory: libs/cua-driver/rust
run: "cargo test -p cua-driver --bin cua-driver proxy::tests:: --locked"
@@ -123,18 +115,6 @@ jobs:
if ($LASTEXITCODE -ne 0) { throw "cursor renderer tests failed with exit $LASTEXITCODE" }
cargo test -p cursor-theme-cli --locked
if ($LASTEXITCODE -ne 0) { throw "cursor theme compiler tests failed with exit $LASTEXITCODE" }
- - name: Run Windows delivery guidance unit tests
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows input::delivery::tests:: --lib --locked"
- - name: Run Windows installed-app discovery unit tests
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows win32::installed_apps::tests:: --lib --locked"
- - name: Run Windows app-name lookup tests
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows launch_uwp::tests:: --lib --locked"
- - name: Run Windows Computer History adapter tests
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows history::tests:: --lib --locked"
- name: Validate Windows Computer History uninstall ordering
run: .\libs\cua-driver\scripts\tests\uninstall-windows-history-regression.ps1
- name: Prove unknown app launch stays bounded and responsive
@@ -163,8 +143,6 @@ jobs:
# from the manifest-free library test target.
cargo test -p cua-driver-uia --lib authorization_tests:: --locked
if ($LASTEXITCODE -ne 0) { throw "UIAccess authorization tests failed with exit $LASTEXITCODE" }
- cargo test -p platform-windows diagnostics::tests:: --lib --locked
- if ($LASTEXITCODE -ne 0) { throw "Windows desktop classification tests failed with exit $LASTEXITCODE" }
- name: Run full SDK unit suite in an interactive runner session
if: steps.runner-session.outputs.session_id != '0'
working-directory: libs/cua-driver/rust
@@ -186,9 +164,6 @@ jobs:
if ($LASTEXITCODE -ne 0) { throw "describe failed with exit $LASTEXITCODE" }
cargo run -p cua-driver --locked -- dump-docs --type cli | Out-Null
if ($LASTEXITCODE -ne 0) { throw "dump-docs failed with exit $LASTEXITCODE" }
- - name: Run Windows browser platform unit tests
- working-directory: libs/cua-driver/rust
- run: "cargo test -p platform-windows browser_platform::tests:: --lib --locked"
- name: Run Windows protocol schema contract
if: steps.runner-session.outputs.session_id != '0'
working-directory: libs/cua-driver/rust
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/perception_client.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/perception_client.rs
index e2b6f7f97e..a035e95e27 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/perception_client.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/perception_client.rs
@@ -1049,7 +1049,11 @@ mod tests {
use std::os::unix::fs::PermissionsExt;
fn with_fixture_interpreter(script: &str) -> String {
- let interpreter = fixture_python_interpreter();
+ // The sandbox grants exec on the canonical interpreter only, and it
+ // cannot read a symlink along a configured path (for example a hosted
+ // runner's `/Applications/Xcode.app -> Xcode_<version>.app`), so the
+ // shebang must name the resolved file.
+ let interpreter = std::fs::canonicalize(fixture_python_interpreter()).unwrap();
script.replacen(
"#!/usr/bin/env python3",
&format!("#!{}", interpreter.display()),
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/perception_tools.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/perception_tools.rs
index 59f50d868d..a3f066275e 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/perception_tools.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/perception_tools.rs
@@ -781,7 +781,8 @@ mod tests {
use std::os::unix::fs::PermissionsExt;
let python = crate::perception_client::fixture_python_config().unwrap();
- let interpreter = python.interpreter;
+ // The sandbox only grants exec on the canonical interpreter.
+ let interpreter = std::fs::canonicalize(&python.interpreter).unwrap();
let service = Arc::new(CaptureService::default());
let (capture_id, binding) = capture(&service);
diff --git a/libs/cua-driver/rust/crates/platform-windows/src/diagnostics.rs b/libs/cua-driver/rust/crates/platform-windows/src/diagnostics.rs
index a1ab5bce9d..6de2266e3c 100644
--- a/libs/cua-driver/rust/crates/platform-windows/src/diagnostics.rs
+++ b/libs/cua-driver/rust/crates/platform-windows/src/diagnostics.rs
@@ -336,7 +336,22 @@ mod tests {
// a predictable way — we accept that as a valid outcome rather
// than failing the test, so the same suite runs green on both
// dev boxes and headless CI runners.
- match ui_automation_available() {
+ //
+ // Other tests in this crate (for example the health report) run the
+ // same probe concurrently through the process-wide UIA single-flight
+ // gate, which answers "busy" instead of queueing. Wait for the gate
+ // rather than treating a sibling test's probe as a failure.
+ let mut result = ui_automation_available();
+ for _ in 0..100 {
+ match &result {
+ Err(e) if e.contains("UI Automation is busy") => {
+ std::thread::sleep(std::time::Duration::from_millis(100));
+ result = ui_automation_available();
+ }
+ _ => break,
+ }
+ }
+ match result {
Ok(()) => {}
Err(e) => {
let non_interactive =