From 6a604fe4d8d81674534687b8fa356bf08af9a08a Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Thu, 19 Nov 2026 22:56:47 +0100 Subject: [PATCH] ci: build the daemon for Windows instead of Linux The Linux job could not get past the linker: libobs-wrapper asks for the OBS 32 scene-item calls and the distro's libobs (30.0.2 on noble, and the OBS PPA publishes no libobs-dev at all) does not have them. That is the state the job has been in, so nothing was building. The daemon ships on Windows, where obs.lib rides with the libobs crate, so the build that matters is the Windows one and cargo-xwin compiles it from the Linux runner with the MSVC runtime and SDK it downloads. The Linux job stays as formatting and clippy over every target: clippy stops at type checking, so it still compiles the cfg(target_os = "linux") paths without linking them. Tests need a machine that can run the exe, so they stay local for now. --- .github/workflows/record-daemon.yml | 52 ++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/.github/workflows/record-daemon.yml b/.github/workflows/record-daemon.yml index 4548dbd..43d1bd9 100644 --- a/.github/workflows/record-daemon.yml +++ b/.github/workflows/record-daemon.yml @@ -13,10 +13,10 @@ env: RUST_BACKTRACE: 1 jobs: - # Make sure that the program correctly builds, - # passes format and lints, as well as tests - build-test: - name: Build, check and test + # Type-checks the daemon on Linux: formatting, and clippy over every target, which compiles + # the cfg(target_os = "linux") paths without linking them. Linking is the Windows job's. + check: + name: Check and lint (Linux) runs-on: ubuntu-latest defaults: run: @@ -34,21 +34,43 @@ jobs: run: cargo fmt --check - name: Install system build dependencies + # pkg-config finds libobs for its build script; nothing is linked here, so the distro's + # version is enough even though the Windows build links a newer obs.lib. run: | sudo apt-get update - sudo apt-get install -y pkg-config libglib2.0-dev libobs-dev libc6-dev clang libwayland-client0 libwayland-dev - - - name: Build - run: cargo build - env: - RUSTFLAGS: -Dwarnings + sudo apt-get install -y pkg-config libglib2.0-dev libobs-dev libc6-dev clang libwayland-dev - name: Lint run: cargo clippy --all-targets --all-features - - name: Run tests with verbose logging (timeout 30min) - run: timeout 30m cargo test -- --nocapture - env: - RUST_LOG: debug + # The daemon ships on Windows and links Windows' obs.lib, so that is the build worth checking. + # It cross-compiles from the Linux runner: obs.lib rides with the libobs crate, and cargo-xwin + # brings the MSVC runtime and the Windows SDK. Tests need a machine that can run the exe, so + # they stay local: `cargo test` in record-daemon on Windows. + build: + name: Build (Windows x64) + runs-on: ubuntu-latest + defaults: + run: + working-directory: record-daemon + steps: + - name: Checkout repository + uses: actions/checkout@v6 - # TODO: Add windows native builds + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-pc-windows-msvc + + - name: Install the cross linker + run: | + sudo apt-get update + sudo apt-get install -y clang lld llvm + + - name: Install cargo-xwin + run: cargo install cargo-xwin --locked + + - name: Build + run: cargo xwin build --target x86_64-pc-windows-msvc + env: + RUSTFLAGS: -Dwarnings