LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
FreeBSD: build and test the workspace in a FreeBSD VM
Brandon Thomas83fb206a290b
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.ymlnew file mode 100644index 000000000..5f93f9978--- /dev/null+++ b/.github/workflows/freebsd.yml@@ -0,0 +1,45 @@+# Builds and tests the workspace on FreeBSD, inside a FreeBSD VM on a Linux runner+# (GitHub has no FreeBSD runners). GPU tests skip themselves when the VM has no adapter.+name: FreeBSD++on:+ push:+ branches: [main]+ pull_request:+ paths:+ - Cargo.toml+ - Cargo.lock+ - "**/Cargo.toml"+ - .github/workflows/freebsd.yml+ workflow_dispatch:++concurrency:+ group: freebsd-${{ github.ref }}+ cancel-in-progress: true++permissions:+ contents: read++jobs:+ freebsd:+ name: FreeBSD 14 (build + test)+ runs-on: ubuntu-latest+ timeout-minutes: 300+ steps:+ - uses: actions/checkout@v4+ - name: Build and test in a FreeBSD VM+ uses: vmactions/freebsd-vm@v1+ with:+ release: "14.3"+ usesh: true+ mem: 12288+ # Nothing to bring back; copying the target dir out of the VM fails on large builds.+ copyback: false+ prepare: |+ pkg install -y curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib+ curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal+ run: |+ . "$HOME/.cargo/env"+ rustc --version+ CARGO_PROFILE_DEV_DEBUG=0 cargo build --workspace --all-targets --locked+ CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --lockeddiff --git a/crates/engine/src/devices.rs b/crates/engine/src/devices.rsindex 825ed5f6d..a934ee44a 100644--- a/crates/engine/src/devices.rs+++ b/crates/engine/src/devices.rs@@ -35,7 +35,9 @@ fn mount_parents() -> Vec<std::path::PathBuf> {let mut out = Vec::new();if cfg!(target_os = "macos") {out.push("/Volumes".into());- } else if cfg!(target_os = "linux") {+ } else if cfg!(any(target_os = "linux", target_os = "freebsd")) {+ // Linux desktops mount under /media/$USER or /run/media/$USER; FreeBSD's automounter+ // (automount/autofs, or a desktop's) under /media. Missing folders are skipped.if let Ok(user) = std::env::var("USER") {out.push(format!("/media/{user}").into());out.push(format!("/run/media/{user}").into());diff --git a/crates/engine/src/memory.rs b/crates/engine/src/memory.rsindex fa7cb878b..d231bf650 100644--- a/crates/engine/src/memory.rs+++ b/crates/engine/src/memory.rs@@ -44,7 +44,12 @@ fn total_ram() -> Option<usize> {let out = std::process::Command::new("/usr/sbin/sysctl").args(["-n", "hw.memsize"]).output().ok()?;String::from_utf8_lossy(&out.stdout).trim().parse().ok()}- #[cfg(not(any(target_os = "linux", target_os = "macos")))]+ #[cfg(target_os = "freebsd")]+ {+ let out = std::process::Command::new("/sbin/sysctl").args(["-n", "hw.physmem"]).output().ok()?;+ String::from_utf8_lossy(&out.stdout).trim().parse().ok()+ }+ #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "freebsd")))]{None}