Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,46 @@ jobs:
- name: Cargo check
run: cargo check
working-directory: src-tauri

rust-test:
name: Rust Tests
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ matrix.platform }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.platform }}-cargo-

- name: Install system dependencies (Linux only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
build-essential \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev
Comment on lines +193 to +202

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing libxdo-dev compared to other Linux jobs

The release.yml Linux step and the existing build job in ci.yml both install libxdo-dev, but the new rust-test job omits it. If any crate compiled during cargo test --lib --bin ronin-observer links against libxdo, the Linux runner will fail to compile.

Currently the cargo-check job also omits libxdo-dev and presumably works, so this may not be an immediate issue — but for consistency and to avoid future surprises consider adding it:

Suggested change
- name: Install system dependencies (Linux only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
build-essential \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Install system dependencies (Linux only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
build-essential \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev


- name: Run Rust tests
run: cargo test --lib --bin ronin-observer
working-directory: src-tauri
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
working-directory: src-tauri

- name: Build and release
uses: tauri-apps/tauri-action@v0
uses: tauri-apps/tauri-action@850c373b94f35e16e4de61cbb9f6e4876af8c0b4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_DEMO_LAMBDA_URL: ${{ secrets.VITE_DEMO_LAMBDA_URL }}
Expand Down
44 changes: 43 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ zbus = { version = "4", features = ["tokio"] }

[dev-dependencies]
tempfile = "3"
serial_test = "3.0"

6 changes: 6 additions & 0 deletions src-tauri/src/bin/observer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ async fn main() {
#[cfg(target_os = "linux")]
mod tests {
use super::*;
use serial_test::serial;
use std::env;

#[test]
#[serial]
fn test_detect_backend_x11() {
env::set_var("XDG_SESSION_TYPE", "x11");
env::set_var("XDG_CURRENT_DESKTOP", "ubuntu:GNOME");
Expand All @@ -115,6 +117,7 @@ mod tests {
}

#[test]
#[serial]
fn test_detect_backend_wayland_gnome() {
env::set_var("XDG_SESSION_TYPE", "wayland");
env::set_var("XDG_CURRENT_DESKTOP", "GNOME");
Expand All @@ -124,6 +127,7 @@ mod tests {
}

#[test]
#[serial]
fn test_detect_backend_wayland_gnome_mixed_case() {
env::remove_var("XDG_SESSION_TYPE");
env::set_var("XDG_SESSION_TYPE", "wayland");
Expand All @@ -134,6 +138,7 @@ mod tests {
}

#[test]
#[serial]
fn test_detect_backend_wayland_kde() {
env::set_var("XDG_SESSION_TYPE", "wayland");
env::set_var("XDG_CURRENT_DESKTOP", "KDE");
Expand All @@ -146,6 +151,7 @@ mod tests {
}

#[test]
#[serial]
fn test_detect_backend_unknown() {
env::set_var("XDG_SESSION_TYPE", "unknown");
env::set_var("XDG_CURRENT_DESKTOP", "unknown");
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/commands/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,7 @@ mod tests {
}

#[tokio::test]
#[cfg_attr(windows, ignore = "Windows CI runners don't support Git hooks consistently")]
async fn test_commit_changes_pre_commit_hook_failure() {
let temp_repo = create_test_repo();
let repo_path = temp_repo.path();
Expand Down
Loading