rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Added determinism inspection workflow

Open UebelAndre opened this issue 8 months ago • 4 comments

This change adds a github workflow that generates a report of whether or not rules_rust is deterministic on a particular platform.

How it works: The workflow checks out main of rules_rust and builds //... back to back from two different directories. Each output within the output_user_root directory is hashed for each checkout and compared. Any hash which is not identical indicates a non-deterministic output.

The workflow is currently configured to run on Linux, MacOS, and Windows.

UebelAndre avatar Mar 15 '25 13:03 UebelAndre

The windows side of this is running into https://github.com/bazelbuild/bazel/issues/19710

And I ended up needing to switch the --output_user_root from D:/r to C:/r

UebelAndre avatar Mar 20 '25 14:03 UebelAndre

Results show targets are not deterministic 😞

this is something we’ll have to fix over time

https://github.com/bazelbuild/rules_rust/actions/runs/14020126362

UebelAndre avatar Mar 24 '25 14:03 UebelAndre

@UebelAndre I'm very interested in this. I have a need for determinism, are you using incremental=false? I have a vague recollection that reproducible builds generally require that the build not be incremental. To clarify, that's just about making the per-crate builds not be incremental, it shouldn't do any harm to the bazel build graph incrementality.

bitemyapp avatar Apr 16 '25 02:04 bitemyapp

@UebelAndre I'm very interested in this. I have a need for determinism, are you using incremental=false? I have a vague recollection that reproducible builds generally require that the build not be incremental. To clarify, that's just about making the per-crate builds not be incremental, it shouldn't do any harm to the bazel build graph incrementality.

Does incremental=false (the cargo setting?) actually have any impact here? Actions will be run in a sandbox and thus would never be incremental, right?

UebelAndre avatar Apr 16 '25 15:04 UebelAndre