Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

fix: run Rust tests in CI (#671)

Josh Ribakoffa033a67b1390
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000..818ab3ca
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,24 @@
+name: "test"
+on: [pull_request]
+
+jobs:
+ rust-tests:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install system dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libasound2-dev libssl-dev
+
+ - name: Use mock TranscriptionManager (CI only)
+ working-directory: src-tauri
+ run: |
+ # Swap to mock adapter - avoids compiling whisper/Vulkan
+ cp src/managers/transcription_mock.rs src/managers/transcription.rs
+ sed -i '/^transcribe-rs/d' Cargo.toml
+
+ - name: Run Rust tests
+ working-directory: src-tauri
+ run: cargo test
diff --git a/src-tauri/src/managers/transcription_mock.rs b/src-tauri/src/managers/transcription_mock.rs
new file mode 100644
index 00000000..63c92cae
--- /dev/null
+++ b/src-tauri/src/managers/transcription_mock.rs
@@ -0,0 +1,55 @@
+// CI-only mock TranscriptionManager - avoids whisper/Vulkan dependencies.
+// This file is copied over transcription.rs during CI tests.
+// Existing tests don't exercise transcription, so this is safe.
+
+use crate::managers::model::ModelManager;
+use anyhow::Result;
+use serde::Serialize;
+use std::sync::Arc;
+use tauri::AppHandle;
+
+#[derive(Clone, Debug, Serialize)]
+pub struct ModelStateEvent {
+ pub event_type: String,
+ pub model_id: Option<String>,
+ pub model_name: Option<String>,
+ pub error: Option<String>,
+}
+
+#[derive(Clone)]
+pub struct TranscriptionManager {
+ #[allow(dead_code)]
+ app_handle: AppHandle,
+}
+
+impl TranscriptionManager {
+ pub fn new(app_handle: &AppHandle, _model_manager: Arc<ModelManager>) -> Result<Self> {
+ Ok(Self {
+ app_handle: app_handle.clone(),
+ })
+ }
+
+ pub fn is_model_loaded(&self) -> bool {
+ false
+ }
+
+ pub fn unload_model(&self) -> Result<()> {
+ Ok(())
+ }
+
+ pub fn maybe_unload_immediately(&self, _context: &str) {}
+
+ pub fn load_model(&self, _model_id: &str) -> Result<()> {
+ Ok(())
+ }
+
+ pub fn initiate_model_load(&self) {}
+
+ pub fn get_current_model(&self) -> Option<String> {
+ None
+ }
+
+ pub fn transcribe(&self, _audio: Vec<f32>) -> Result<String> {
+ Ok(String::new())
+ }
+}