From 3093b41033f63a33eac5efbf213f13a9fcf2aef7 Mon Sep 17 00:00:00 2001 From: dillonj Date: Thu, 7 May 2026 11:23:34 -0600 Subject: [PATCH] Bundle FFmpeg as Tauri sidecar, download in CI --- .github/workflows/release.yml | 8 +++++++ docs/gitea-runner-windows.md | 44 +++++++++++++++++++++++++++++++++++ src-tauri/.gitignore | 1 + src-tauri/src/lib.rs | 9 +++++++ src-tauri/src/paths.rs | 33 +++++++++++++++++++++++++- src-tauri/tauri.conf.json | 4 ++++ 6 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 docs/gitea-runner-windows.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a508606..974dc91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,14 @@ jobs: libgtk-3-dev \ libayatana-appindicator3-dev \ rpm + - name: Download FFmpeg (bundled sidecar) + run: | + mkdir -p src-tauri/binaries + curl -sL "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" -o /tmp/ffmpeg.tar.xz + tar -xf /tmp/ffmpeg.tar.xz -C /tmp + cp /tmp/ffmpeg-*-amd64-static/ffmpeg src-tauri/binaries/ffmpeg-x86_64-unknown-linux-gnu + cp /tmp/ffmpeg-*-amd64-static/ffprobe src-tauri/binaries/ffprobe-x86_64-unknown-linux-gnu + chmod +x src-tauri/binaries/* - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/gitea-runner-windows.md b/docs/gitea-runner-windows.md new file mode 100644 index 0000000..b3a7809 --- /dev/null +++ b/docs/gitea-runner-windows.md @@ -0,0 +1,44 @@ +# Gitea Runner — Windows Laptop + +Self-hosted runner registered as `windows-laptop` with label `windows-latest`. + +## Setup + +```powershell +# Download +Invoke-WebRequest -Uri "https://gitea.com/gitea/runner/releases/download/v1.0.1/gitea-runner-1.0.1-windows-amd64.exe" -OutFile "$env:USERPROFILE\gitea-runner-windows-amd64.exe" + +# Register (Admin PowerShell) +.\gitea-runner-windows-amd64.exe register --instance http://143.244.157.110:3000 --token NS5LXzLzNOvPKD9Id4SrLQ09bReHOrn6T2c4EyGM --name windows-laptop --labels windows-latest --no-interactive + +# Start (foreground) +.\gitea-runner-windows-amd64.exe daemon + +# Install as Windows service (auto-starts on boot) +.\gitea-runner-windows-amd64.exe service install +``` + +## Logs + +### Workflow job logs (step output) + +Stored on the Gitea server (not locally). Download from: +`http://143.244.157.110:3000///actions/runs/` + +Click a job, then the **Download log** button at the top-right. + +### Runner daemon logs (runner itself) + +| Mode | Log location | +|---|---| +| Foreground (`daemon`) | PowerShell console stdout | +| Windows service (`service install`) | `%ProgramData%\gitea-runner\log\` or Windows Event Viewer → Windows Logs → Application | + +## Diagnostics + +If a CI job fails, download the full log from the Gitea Actions UI (as above), then search for the first error: + +- **Rust**: look for `error[E...]`, `error: could not compile`, or `cargo test` failures +- **Python**: look for `FAILED`, `AssertionError`, or `ModuleNotFoundError` + +The runner's own logs (`daemon` mode) will show which job it picked up, container lifecycle, and any infrastructure issues (disk full, Docker unavailable, etc.). diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore index 502406b..fb1676b 100644 --- a/src-tauri/.gitignore +++ b/src-tauri/.gitignore @@ -2,3 +2,4 @@ # will have compiled files and executables /target/ /gen/schemas +binaries/ diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index db488a2..adfd832 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -397,6 +397,15 @@ pub fn run() { } } + // Add bundled ffmpeg/ffprobe to PATH so Python subprocesses find them + if let Some(ffmpeg_dir) = paths::bundled_ffmpeg().and_then(|p| p.parent().map(|p| p.to_path_buf())) { + if let Ok(current_path) = std::env::var("PATH") { + let new_path = format!("{}:{}", ffmpeg_dir.display(), current_path); + std::env::set_var("PATH", &new_path); + } + log::info!("Added bundled FFmpeg directory to PATH: {}", ffmpeg_dir.display()); + } + Ok(()) }) .invoke_handler(tauri::generate_handler![ diff --git a/src-tauri/src/paths.rs b/src-tauri/src/paths.rs index 641eeee..72d1ed1 100644 --- a/src-tauri/src/paths.rs +++ b/src-tauri/src/paths.rs @@ -62,7 +62,38 @@ pub fn backend_script(name: &str) -> PathBuf { project_root().join("backend").join(name) } -/// Absolute path to a script at the project root. +/// Locate bundled ffmpeg binary (sidecar). +pub fn bundled_ffmpeg() -> Option { + let exe = std::env::current_exe().ok()?; + let dir = exe.parent()?; + // Tauri places externalBin next to the executable + let candidates = [ + dir.join("ffmpeg"), + dir.join("binaries").join("ffmpeg"), + ]; + for c in &candidates { + if c.exists() { + return Some(c.clone()); + } + } + None +} + +/// Locate bundled ffprobe binary (sidecar). +pub fn bundled_ffprobe() -> Option { + let exe = std::env::current_exe().ok()?; + let dir = exe.parent()?; + let candidates = [ + dir.join("ffprobe"), + dir.join("binaries").join("ffprobe"), + ]; + for c in &candidates { + if c.exists() { + return Some(c.clone()); + } + } + None +} pub fn root_script(name: &str) -> PathBuf { project_root().join(name) } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index cb2e6e9..9b5d023 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -35,6 +35,10 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" + ], + "externalBin": [ + "binaries/ffmpeg", + "binaries/ffprobe" ] } }