-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(lib): do not run build script based on changes to kernel_v0.rs
#991
build(lib): do not run build script based on changes to kernel_v0.rs
#991
Conversation
0xPolygonMiden#887 added a build script that builds `kernel_v0.rs`, but the script runs on changes to the file itself. I suspect this was the reason for test times doubling after that PR as pointed out in 0xPolygonMiden#903. This PR simply removes this rerun check. I doubt this check is the correct behaviour either way, since if it reruns based on changes to the `kernel_v0.rs`, it means it reruns every time the file is generated - which means the build script is triggered between each invocation of `cargo nextest` as well.
Thank you, I think your diagnosis is correct. I wonder if the kernel errors file should also be removed in a similar fashion. More generally I think the issue is that we're generating code in the source directory which isn't correct. |
Thanks! We recently had problems with the docs.rs docs not building and the build was failing because of a "read-only" filesystem. This was also because we're writing to
So not necessarily for this PR, but it seems to me that it would be better to just move to the include approach and not write I'm curious why the CI times already went down even though the same problem should exist for the |
The error file write is skipped most of the time: // Skip this build script in BUILD_KERNEL_ERRORS environment variable is not set to `1`.
if env::var("BUILD_KERNEL_ERRORS").unwrap_or("0".to_string()) == "1" {
// Generate kernel error constants.
generate_kernel_error_constants(&source_dir)?;
} @eightfilms could you also remove this ^^ variable from the |
Probably because generating that file is gated behind an environment variable: https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/build.rs#L80C5-L83C6 Regardless, +1 on the sentiment that writing into Edit: got frontrun by @Mirko-von-Leipzig :) just saw your comment, will do once I'm back at the computer |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
#887 added a build script that builds
kernel_v0.rs
, but the script runs on changes to the file itself. I suspect this was the reason for test times doubling after that PR as pointed out in #903.This PR simply removes this rerun check. I doubt this check is the correct behaviour either way, since if it reruns based on changes to the
kernel_v0.rs
, it means it reruns every time the file is generated - which means the build script is triggered between each invocation ofcargo nextest
as well.I've tested this in my personal repo - the run is here: https://github.com/eightfilms/miden-base/actions/runs/12064550221/job/33641593187 and is based on this branch: https://github.com/eightfilms/miden-base/tree/refs/heads/kernel-build-once. There is no longer recompilation between the different test steps, which means we should expect to see CI times for the test step go back down to ~15 minutes from ~40 minutes (which is similar to the last commit prior to #887)