terraphim / terraphim/terraphim-ai
feat(ci): cross-compile Windows binaries from Linux using cargo-xwin
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 62
- Forks
- 5
- Avg merge
- 2h 27m
- Merged PRs (30d)
- 1
Description
Summary
Replace the windows-latest GitHub Actions runner for binary builds with cargo-xwin cross-compilation from Linux. This eliminates the need for a Windows runner entirely, reducing CI cost and simplifying runner management.
Background
The current release workflow (release-comprehensive.yml) uses a windows-latest runner to build x86_64-pc-windows-msvc binaries natively. This works but:
- Windows runners cost ~2x more than Linux ($0.016/min vs $0.008/min)
- Adds a separate OS to maintain in CI matrix
- Has caused packaging issues (e.g., #559 --
zipnot available on Windows runners, fixed by #565 with7z)
Proposed Change
Use cargo-xwin on a Linux runner to cross-compile Windows MSVC binaries:
# Replace windows-latest matrix entry with:
- os: ubuntu-22.04
target: x86_64-pc-windows-msvc
use_cross: false
cross_tool: cargo-xwin
Prerequisites on Linux runner
rustup target add x86_64-pc-windows-msvc
cargo install cargo-xwin
sudo apt-get install -y clang llvm
Build command
cargo xwin build --release --target x86_64-pc-windows-msvc
Dependency compatibility
- reqwest (rustls-tls): Pure Rust TLS -- no OpenSSL needed, works seamlessly
- tokio: Full support via IOCP on Windows target
- salvo: Standard async framework, no platform-specific issues
- serde, clap, ratatui, crossterm: All cross-platform compatible
Scope
- Add
cargo-xwininstallation step to release workflow - Replace
windows-latestmatrix entry with Linux + cargo-xwin for binary builds - Keep
windows-latestfor Tauri desktop builds (requires native Windows SDK) - Update artifact packaging (use standard
zipon Linux instead of7z) - Cache Windows SDK download (
cargo xwin cachein v0.21.4+) - Validate produced
.exebinaries work correctly
Notes
- Tauri desktop builds (
build-tauri-desktop) must stay onwindows-latestsince they need the full Windows SDK for MSI/NSIS installer generation - Only the CLI binary builds (
build-binariesmatrix) should move to cargo-xwin - The
terraphim_server/build.rshas a#[cfg(target_os = "windows")]check for frontend assets that may need adjustment for cross-compilation (build.rs runs on host, not target)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with release-comprehensive.yml and compare the build-binaries matrix with build-tauri-desktop. Review the existing Windows packaging steps, then run the proposed cargo-xwin build on Linux and inspect terraphim_server/build.rs for the noted target check. Done means CLI Windows binaries build and package successfully through Linux while Tauri builds remain on windows-latest.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, linux, rust
- Domain
- build-system, ci-cd, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100