Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

ci: use system ffmpeg in linux e2e prebuild

Louis Beaumont5e5d13a1698e
diff --git a/apps/screenpipe-app-tauri/scripts/pre_build.js b/apps/screenpipe-app-tauri/scripts/pre_build.js
index f1d0f942c..3996103a4 100644
--- a/apps/screenpipe-app-tauri/scripts/pre_build.js
+++ b/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -246,6 +246,22 @@ async function copyFile(src, dest) {
await fs.chmod(dest, 0o755); // ensure the binary is executable
}
+async function linkSystemBinary(binaryName, destination) {
+ try {
+ const source = (await $`command -v ${binaryName}`.text()).trim();
+ if (!source) {
+ return false;
+ }
+ await fs.rm(destination, { force: true });
+ await fs.symlink(source, destination);
+ console.log(`using system ${binaryName}: ${source} -> ${destination}`);
+ return true;
+ } catch (error) {
+ console.warn(`could not link system ${binaryName}: ${error.message}`);
+ return false;
+ }
+}
+
/* ########## Linux ########## */
if (platform == 'linux') {
// In CI, cache-apt-pkgs-action already installs packages; skip redundant apt install
@@ -287,17 +303,34 @@ if (platform == 'linux') {
// Setup FFMPEG
if (!(await fs.exists(config.ffmpegRealname))) {
- await $`wget --no-config -nc ${config.linux.ffmpegUrl} -O ${config.linux.ffmpegName}.tar.xz`
- await $`tar xf ${config.linux.ffmpegName}.tar.xz`
- await $`mv ${config.linux.ffmpegName} ${config.ffmpegRealname}`
- await $`rm ${config.linux.ffmpegName}.tar.xz`
+ if (inCI) {
+ await fs.mkdir(config.ffmpegRealname, { recursive: true });
+ const linkedFfmpeg = await linkSystemBinary('ffmpeg', path.join(config.ffmpegRealname, 'ffmpeg'));
+ await linkSystemBinary('ffprobe', path.join(config.ffmpegRealname, 'ffprobe'));
+ await linkSystemBinary('qt-faststart', path.join(config.ffmpegRealname, 'qt-faststart'));
+ if (!linkedFfmpeg) {
+ throw new Error('CI expected ffmpeg from apt, but command -v ffmpeg failed');
+ }
+ } else {
+ await $`wget --no-config -nc ${config.linux.ffmpegUrl} -O ${config.linux.ffmpegName}.tar.xz`
+ await $`tar xf ${config.linux.ffmpegName}.tar.xz`
+ await $`mv ${config.linux.ffmpegName} ${config.ffmpegRealname}`
+ await $`rm ${config.linux.ffmpegName}.tar.xz`
+ }
} else {
console.log('FFMPEG already exists');
}
// Setup TESSERACT
if (!(await fs.exists(config.linux.tesseractName))) {
- await $`wget --no-config -nc ${config.linux.tesseractUrl} -O ${config.linux.tesseractName}`
- await $`chmod +x ${config.linux.tesseractName}` // Make the Tesseract binary executable
+ if (inCI) {
+ const linkedTesseract = await linkSystemBinary('tesseract', config.linux.tesseractName);
+ if (!linkedTesseract) {
+ throw new Error('CI expected tesseract from apt, but command -v tesseract failed');
+ }
+ } else {
+ await $`wget --no-config -nc ${config.linux.tesseractUrl} -O ${config.linux.tesseractName}`
+ await $`chmod +x ${config.linux.tesseractName}` // Make the Tesseract binary executable
+ }
} else {
console.log('TESSERACT already exists');
}