Reproducible release build: scripts/build-release.ps1, and a workflow that builds and attests victory.exe #872

Open
github-bot wants to merge 1 commit from github-bot/gh-872 into main AGit
Owner

@⁠jptorres96 on GitHub · 2026-11-28 08:18 UTC · original
jptorres96:reproducible-release → main · +143 −0 · 3 files · 1 commits · open

Releases that can be checked against the source. The release notes give the commit and a SHA-256, but building that commit does not give that SHA-256: on 48ad785, two checkouts on one PC and the release came out as three different hashes. The exe also carries the builder's checkout path, user folder included (env!("CARGO_MANIFEST_DIR") in victory-core, victory-pipeline and the shader build script).

  • scripts/build-release.ps1: builds from a subst drive (V:\) so every build sees the same paths, remaps cargo's registry, and links with /Brepro and /PDBALTPATH (no timestamp, no random PDB GUID). It writes dist/victory.exe and victory.exe.sha256, and prints the commit, rustc and MSVC versions to publish with the hash.
  • .github/workflows/release.yml: on a v* tag (or by hand), builds with that script on a GitHub runner, signs a build provenance attestation, and attaches the exe and its hash to the tag's release (a draft if there is none). gh attestation verify victory.exe --repo trustno1-coder/VIctory-NVIDIA then shows which commit and workflow built a download.
  • README: a short paragraph on checking the download.

Checked on Windows (rustc 1.98.1, MSVC 14.42.34433): at 48ad785, two checkouts in different folders built to the same SHA-256 with this recipe; at this branch's head, scripts/build-release.ps1 run in two checkouts gave the same 55EB502D…E318. Matching bytes across PCs also needs the same MSVC tools, which is why the script prints them.

Actions shows no runs on this repository, so it may need enabling (Settings → Actions) for the workflow to run. No runtime code changes.

**@⁠jptorres96** on GitHub · 2026-11-28 08:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/872) `jptorres96:reproducible-release` → `main` · +143 −0 · 3 files · 1 commits · open **Releases that can be checked against the source.** The release notes give the commit and a SHA-256, but building that commit does not give that SHA-256: on 48ad785, two checkouts on one PC and the release came out as three different hashes. The exe also carries the builder's checkout path, user folder included (`env!("CARGO_MANIFEST_DIR")` in victory-core, victory-pipeline and the shader build script). - `scripts/build-release.ps1`: builds from a `subst` drive (`V:\`) so every build sees the same paths, remaps cargo's registry, and links with `/Brepro` and `/PDBALTPATH` (no timestamp, no random PDB GUID). It writes `dist/victory.exe` and `victory.exe.sha256`, and prints the commit, rustc and MSVC versions to publish with the hash. - `.github/workflows/release.yml`: on a `v*` tag (or by hand), builds with that script on a GitHub runner, signs a build provenance attestation, and attaches the exe and its hash to the tag's release (a draft if there is none). `gh attestation verify victory.exe --repo trustno1-coder/VIctory-NVIDIA` then shows which commit and workflow built a download. - README: a short paragraph on checking the download. Checked on Windows (rustc 1.98.1, MSVC 14.42.34433): at 48ad785, two checkouts in different folders built to the same SHA-256 with this recipe; at this branch's head, `scripts/build-release.ps1` run in two checkouts gave the same `55EB502D…E318`. Matching bytes across PCs also needs the same MSVC tools, which is why the script prints them. Actions shows no runs on this repository, so it may need enabling (Settings → Actions) for the workflow to run. No runtime code changes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:29:13 +00:00
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-28 21:21 UTC · original · edited 2026-11-28 21:34 UTC

One compatibility case for scripts/build-release.ps1 at 6154310: a space in CARGO_HOME splits the remap argument before compilation. With a dependency-free library, Cargo/rustc 1.98.1 on Linux and cargo check --release --offline --target x86_64-pc-windows-msvc, the script’s space-joined flags passed with CargoHome (exit 0) and failed with Cargo Home (exit 101: --remap-path-prefix must contain '=' between FROM and TO). With the same spaced path and the same arguments joined with ASCII 31 in CARGO_ENCODED_RUSTFLAGS, the check passed (exit 0).

Suggested fix: keep each rustc argument separate (including -C and its value), join with [char]31, and restore the previous encoded environment value in finally. This checks Cargo argument handling only. I did not run the Windows release script, link an EXE, or compare release hashes.

A second offline check on 1.98.1 showed that even an explicitly empty CARGO_ENCODED_RUSTFLAGS suppresses RUSTFLAGS. A library requiring --cfg recipe_marker passed with that marker in RUSTFLAGS alone. With the encoded variable empty the marker was absent; with an encoded user marker only the user marker reached rustc. Passing the recipe marker in the encoded variable passed again. For reproducible builds, set the encoded recipe in the Cargo child environment and reject conflicting caller flags up front, leaving the caller’s environment intact.

**@⁠ANDREANIADS** on GitHub · 2026-11-28 21:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/872#issuecomment-7245959515) · edited 2026-11-28 21:34 UTC One compatibility case for `scripts/build-release.ps1` at `6154310`: a space in `CARGO_HOME` splits the remap argument before compilation. With a dependency-free library, Cargo/rustc 1.98.1 on Linux and `cargo check --release --offline --target x86_64-pc-windows-msvc`, the script’s space-joined flags passed with `CargoHome` (exit 0) and failed with `Cargo Home` (exit 101: `--remap-path-prefix must contain '=' between FROM and TO`). With the same spaced path and the same arguments joined with ASCII 31 in `CARGO_ENCODED_RUSTFLAGS`, the check passed (exit 0). Suggested fix: keep each rustc argument separate (including `-C` and its value), join with `[char]31`, and restore the previous encoded environment value in `finally`. This checks Cargo argument handling only. I did not run the Windows release script, link an EXE, or compare release hashes. A second offline check on 1.98.1 showed that even an explicitly empty `CARGO_ENCODED_RUSTFLAGS` suppresses `RUSTFLAGS`. A library requiring `--cfg recipe_marker` passed with that marker in `RUSTFLAGS` alone. With the encoded variable empty the marker was absent; with an encoded user marker only the user marker reached rustc. Passing the recipe marker in the encoded variable passed again. For reproducible builds, set the encoded recipe in the Cargo child environment and reject conflicting caller flags up front, leaving the caller’s environment intact.
This pull request has changes conflicting with the target branch.
  • README.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/872/head:github-bot/gh-872'
git switch 'github-bot/gh-872'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-872'
git switch 'github-bot/gh-872'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-872'
git switch 'github-bot/gh-872'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-872'
git switch 'main'
git merge --squash 'github-bot/gh-872'
git switch 'main'
git merge --ff-only 'github-bot/gh-872'
git switch 'main'
git merge 'github-bot/gh-872'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!872
No description provided.