diff --git a/.github/workflows/linux-app.yml b/.github/workflows/linux-app.yml index ce6567c56171..8e1d4bd37c33 100644 --- a/.github/workflows/linux-app.yml +++ b/.github/workflows/linux-app.yml @@ -70,6 +70,10 @@ jobs: working-directory: apps/linux/src-tauri run: cargo +stable fmt --check + - name: Run Rust tests + working-directory: apps/linux/src-tauri + run: cargo +stable test --locked --all-targets + - name: Build Linux companion bundles working-directory: apps/linux/src-tauri env: @@ -90,8 +94,8 @@ jobs: apps/linux/src-tauri/target/release/bundle/deb/*.deb apps/linux/src-tauri/target/release/bundle/appimage/*.AppImage - check-macos: - name: Check macOS companion + test-macos: + name: Test macOS companion # This app also ships macOS desktop-test bundles, but the only job that # compiles them (linux-app-release.yml build_macos) runs behind a manual # dispatch input. Without a per-PR check, a macOS-gated Tauri API can break @@ -126,6 +130,10 @@ jobs: restore-keys: | macos-app-${{ runner.os }}- - - name: Check macOS companion + - name: Test macOS companion working-directory: apps/linux/src-tauri - run: cargo +stable check --locked --all-targets + # `test` rather than `check`: it additionally links and runs the + # binaries, which is the only way macOS link-time breakage (a missing + # Swift runtime rpath, say) shows up at all. `--all-targets` keeps the + # compile coverage `check --all-targets` used to give. + run: cargo +stable test --locked --all-targets diff --git a/apps/linux/src-tauri/build.rs b/apps/linux/src-tauri/build.rs index bd4adf8500d5..362837f7b2a1 100644 --- a/apps/linux/src-tauri/build.rs +++ b/apps/linux/src-tauri/build.rs @@ -1,4 +1,5 @@ fn main() { + link_macos_swift_runtime(); // Command metadata generates capability permissions independently of the // target's invoke handler, so keep the Linux-only command permission known. const COMMANDS: &[&str] = &[ @@ -20,3 +21,15 @@ fn main() { ) .expect("Tauri build configuration should be valid"); } + +/// tauri-plugin-notifications links a Swift static library into us, but nothing +/// adds an rpath for the Swift runtime it pulls in. Bundled apps get one from +/// the bundler; plain `cargo run` and `cargo test` binaries do not, so they die +/// at load with `Library not loaded: @rpath/libswift_Concurrency.dylib`. Point +/// them at the OS runtime so the test suite is runnable on macOS. +fn link_macos_swift_runtime() { + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("macos") { + return; + } + println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift"); +} diff --git a/apps/linux/src-tauri/src/gateway_ws.rs b/apps/linux/src-tauri/src/gateway_ws.rs index d411a8b2c4d7..580502bc765a 100644 --- a/apps/linux/src-tauri/src/gateway_ws.rs +++ b/apps/linux/src-tauri/src/gateway_ws.rs @@ -1660,7 +1660,8 @@ mod tests { false, ) .expect("pinned connect params"); - assert_eq!(pinned_params["caps"], json!([])); + // Pinning only withdraws inline widgets; agent-kind is unconditional. + assert_eq!(pinned_params["caps"], json!([AGENT_KIND_CLIENT_CAPABILITY])); std::fs::remove_dir_all(directory).expect("remove connect fixture"); }