Repository navigation
#1488 CI/packaging for rust2 builds - #1554
Merged
Merged
Conversation
…log the WINUXCMD_ENABLE_RUST2 surface (Refs #1488) A build with Rust is the first-class product (#1550: WINUXCMD_ENABLE_RUST2 defaults ON when cargo is found; replaced commands - true;false - are dropped when it is OFF, never dual-tracked). Harden the CI accordingly: - replace the arm64-only rustup target step with a pinned-toolchain setup (RUST2_TOOLCHAIN=1.99.1, matching the windows-2025 image) that installs BOTH msvc targets on EVERY leg: the arch skew run 42581933801 hit (LNK2001 winuxcmd_abi_version/run/free_buf on arm64, pre-#1553) must stay impossible by construction, and the aarch64 std library is not in the image's default installation. - pass -DWINUXCMD_ENABLE_RUST2=ON explicitly on all three configure invocations (main, PGO train, PGO rebuild) so a cargo-less runner fails at configure time instead of silently shrinking the applet set. - cache ~/.cargo registry/git (workspace has zero external crates; the per-tree rust2-target dirs are deliberately not cached - fresh checkout mtimes force a cargo rebuild anyway). - new 'Record rust2 build surface' step: one RUST2_STATUS log line (ON/arch/triple/toolchain/rustc) per leg and a rust2-build-status.txt marker uploaded with the packages for the cross-arch consistency check that follows; fails the leg loudly if the per-triple winuxcmd_ffi.lib is missing (#1553 moved it under the triple directory).
…ckaging guard) (Refs #1488) New rust2-surface-check job (needs build-windows, runs on every CI run, gates release) enforcing the one-product invariant: the x64 and arm64 legs must carry the SAME rust2 command library. The arm64 exe cannot be executed on the x64 runner (no ARM64 emulation on x64 Windows), so parity is enforced on four layers: 1. PE machine type of both shipped winuxcmd.exe images (0x8664 / 0xAA64). 2. Per-leg rust2-build-status.txt markers compared: rust2=ON on both, same command set, same pinned toolchain and rustc version. 3. The x64 exe dispatches the replaced commands with the GNU exit-code contract: true=0, false=1, true --version=0, false --version=1 (coreutils true.c sole-argument rule; false keeps EXIT_STATUS 1 - the same rule the rust2 gate pins in rust2/gate/cases). Local probe against the multicall dispatcher confirms the rc set. 4. Packaging guard: no stray rust2/toolchain files (winuxcmd_ffi, rlib/rmeta/pdb) in either archive - the staticlib is folded into winuxcmd.exe by the link run, so there is nothing to distribute. release now needs the check, so a tag cannot publish an arch-skewed applet set. Native arm64 behavioral probing (windows-11-arm runner) can replace layer 3's arch asymmetry later without changing the contract.
…y (Refs #1488) Document what a builder needs now that true/false live in Rust (#1550): rustup + both MSVC targets (aarch64-pc-windows-msvc is required for cross arm64 builds - cargo --target per the C++ target arch, #1553), the WINUXCMD_ENABLE_RUST2 switch semantics (auto-ON with cargo, OFF without, explicit ON without cargo = configure error), and the honest degradation story: no C++ fallback, replaced commands simply absent from a rust-less applet set (never dual-tracked). Sections: README.md 'Building from source' (+prereq line), README-zh.md, CONTRIBUTING.md prerequisites, AGENTS.md How to build.
The version pin installs under its own rustup slot (1.99.1-x86_64-pc-windows-msvc), separate from the image's stable alias, so each leg would otherwise download the full toolchain every run. Cache the slot (aarch64 std included after the first target add) so only the first leg pays for it.
The surface-check job parses markers as key=value; the bare rustc line parsed as a keyless entry and the cross-arch rustc comparison degraded to null==null. Emit rustc=<version> so the comparison is real.
'cargo rustc --version' is not a version query - cargo rustc is the build subcommand and rejects --version (exit != 0, null stdout), which killed the marker step under ErrorActionPreference=Stop on every leg that reached it (reproduced locally under pwsh). Use the rustc shim (%USERPROFILE%\.cargo\bin\rustc.exe --version), which reports the pinned default toolchain.
download-artifact@v8 extracts pattern-matched artifacts flat into the download path (verified in run 42813275974: both downloads log 'to: ...pkgs', PE checks passed but the shared rust2-build-status.txt was not found under a -x64\ path and would have been overwritten by the arm64 download). Name the marker per arch (rust2-build-status-x64.txt / -arm64.txt) so the layout cannot collide, list the pkgs tree in the check log for debuggability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1488. Makes the Rust-carrying build a first-class citizen of the CI/packaging pipeline (#1550, #1553 follow-up).
Audit findings (evidence first)
WINUXCMD_ENABLE_RUST2, cargo-gated, replaced commands never dual-tracked) and build(rust2): build the ffi staticlib for the C++ target arch (Refs #1552) #1553 (staticlib built with--targetfor the C++ target arch) verified on main: all four build-windows legs configure withrust2 command library: ON (true;false)(run 42764286500, cargo atC:/Users/runneradmin/.cargo/bin/cargo.exe).LNK2001: winuxcmd_abi_version / winuxcmd_run / winuxcmd_free_bufbecause cargo had built the staticlib for the host x86_64 triple. The "silently degraded" variant (cargo missing -> no true/false) cannot happen on current runners (cargo is preinstalled), but nothing in CI asserted it. This PR makes that class loud.winuxcmd.exe+winuxcmd-shim.exe+ 6 lifecycle scripts + docs (CMakeLists.txt:876-925); the .iss installer stages viacmake --install(scripts/build-installer.ps1), so no rust2 file can leak. The staticlib is folded into the exe by the link run - nothing to distribute. A permanent stray-file guard was added to CI anyway.CI changes
RUST2_TOOLCHAIN=1.99.1, matching the windows-2025 image) replacing the arm64-only rustup step; both MSVC targets installed on all four legs, cached via actions/cache (toolchain slot + cargo registry; per-treerust2-targetdirs deliberately not cached - fresh checkout mtimes force a cargo rebuild anyway).-DWINUXCMD_ENABLE_RUST2=ONexplicit on all three configure invocations (main/PGO train/PGO rebuild): a cargo-less runner now fails at configure instead of silently shrinking the applet set.RUST2_STATUSlog line + marker file (rust2-build-status.txt) per leg, uploaded with the packages; fails loudly if the per-triplewinuxcmd_ffi.libis missing (build(rust2): build the ffi staticlib for the C++ target arch (Refs #1552) #1553 moved it under the triple directory).rust2-surface-checkjob (gatesrelease): PE machine types (0x8664/0xAA64), cross-arch marker comparison (rust2 ON, same commands/toolchain/rustc), GNU exit-code contract on the x64 exe (true=0,false=1,true --version=0,false --version=1 - coreutils true.c sole-argument rule, probed against the multicall dispatcher), and the packaging stray-file guard.Known limit
The arm64 binary cannot be executed on the x64 runner (no ARM64 emulation on x64 Windows), so behavioral parity for the arm64 slice is enforced by markers + gate coverage (rust2/gate), not by running it. A native probe on a
windows-11-armrunner can close that later without changing the contract.