terraphim / terraphim/terraphim-ai

feat(ci): cross-compile Windows binaries from Linux using cargo-xwin

Open
#566 0 comments 0 reactions 0 assignees View on GitHub

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 -- zip not available on Windows runners, fixed by #565 with 7z)

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-xwin installation step to release workflow
  • Replace windows-latest matrix entry with Linux + cargo-xwin for binary builds
  • Keep windows-latest for Tauri desktop builds (requires native Windows SDK)
  • Update artifact packaging (use standard zip on Linux instead of 7z)
  • Cache Windows SDK download (cargo xwin cache in v0.21.4+)
  • Validate produced .exe binaries work correctly

Notes

  • Tauri desktop builds (build-tauri-desktop) must stay on windows-latest since they need the full Windows SDK for MSI/NSIS installer generation
  • Only the CLI binary builds (build-binaries matrix) should move to cargo-xwin
  • The terraphim_server/build.rs has 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.