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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ jobs:
export PYTHONPATH=$(python3 -c "import site; print(site.getsitepackages()[0])")
cargo test -p coldvox-app --test golden_master -- --nocapture

- name: Run Moonshine E2E Tests
if: matrix.rust-version == 'stable'
run: |
echo "=== Running Moonshine E2E Tests ==="
# Install Python dependencies for Moonshine
pip install transformers torch librosa accelerate
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The Python dependencies are installed without version pinning, which can lead to non-reproducible builds and potential security issues if a dependency is compromised. Consider pinning versions (e.g., pip install transformers==4.36.0 torch==2.1.2 librosa==0.10.1 accelerate==0.25.0) or using a requirements file to ensure consistent test environments across runs.

Copilot uses AI. Check for mistakes.
export PYTHONPATH=$(python3 -c "import site; print(site.getsitepackages()[0])")
# Run the specific E2E test with the moonshine feature enabled
cargo test -p coldvox-stt --features moonshine --test moonshine_e2e -- --nocapture

# GUI groundwork check integrated here
- name: Detect and test Qt 6 GUI
if: matrix.rust-version == 'stable'
Expand Down
33 changes: 25 additions & 8 deletions crates/coldvox-text-injection/test-apps/gtk_test_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>

// Callback function to handle text changes in the GtkEntry
static void on_text_changed(GtkEditable *editable, gpointer user_data) {
Expand All @@ -21,22 +23,34 @@ static void on_text_changed(GtkEditable *editable, gpointer user_data) {

// Create a ready file to signal that the app has started.
// This allows tests to detect when the app is ready without relying on text changes.
static void create_ready_file(void) {
static gboolean create_ready_file(gpointer user_data) {
char filepath[256];
snprintf(filepath, sizeof(filepath), "/tmp/coldvox_gtk_test_%d.txt", getpid());
FILE *f = fopen(filepath, "w");
if (f != NULL) {
// Write empty content - file existence is the signal
fclose(f);

// Securely create the file: O_CREAT | O_EXCL prevents clobbering or symlink attacks
int fd = open(filepath, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (fd == -1) {
perror("Failed to create ready file");
return G_SOURCE_REMOVE; // Do not retry; tests will handle absence
}

// Write the PID to the file so tests can verify content is from the current process
char pidbuf[32];
int len = snprintf(pidbuf, sizeof(pidbuf), "%d", getpid());
if (len > 0) {
ssize_t w = write(fd, pidbuf, (size_t)len);
if (w < 0) {
perror("Failed to write PID to ready file");
}
}

close(fd);
return G_SOURCE_REMOVE; // Run once
}

int main(int argc, char *argv[]) {
gtk_init(&argc, &argv);

// Create the ready file immediately so tests know the app is running
create_ready_file();

// Create the main window
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "GTK Test App");
Expand All @@ -57,6 +71,9 @@ int main(int argc, char *argv[]) {
// Ensure the entry widget has focus when the window appears
gtk_widget_grab_focus(entry);

// Schedule ready file creation for when the main loop starts
g_idle_add(create_ready_file, NULL);

// Start the GTK main loop
gtk_main();

Expand Down
Loading
Loading