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