Move CARGO_HOME to take advantage of cache#192
Conversation
|
Unrequested context: I was researching why Firefox on Linux did not support hybrid web authn, which led to your work here, which I got nosy and looked at the issues and saw CI + help wanted. I like build stuff and figured I'd take a stab! The first build of this PR will probably have the same timings (~6 min) as the rest, but subsequent builds of this PR or any build after this goes to main should really see a benefit. Maybe down to 3 min or so... I think 😄️ |
|
Thanks for looking into this! That's a good explanation. I think we could move the entire build directory out of the workspace directory to avoid other similar issues in the future. Does that make sense? |
|
I moved CARGO_HOME, and the rest of the build folder, but it still looks like it's using 115 MB of compressed data. I think that makes sense because my local CARGO_HOME is only 300 MB. One weird thing now is that the target directory is being treated as a relative directory even though it is being passed as absolute (logs). If you're interested in looking more into that, that'd be helpful, but I think I'll leave it for now. |
It's a good idea for general cleanliness! It would have still missed this particular cache miss, though, because the rust cache looks at the location of the source of the dependency (under If you do move the build folder, remember to update the
That's correct. I incorrectly correlated the size of the "local" sources (hundreds of MB) with the size of their outputs (gB). I'll remove that line from the description.
Dug into this, it's because it reports all paths as absolute: https://github.com/Swatinem/rust-cache/blob/7e35be21c2b94d972b1143087fabc27d7dc881ef/src/config.ts#L155 . I searched its source for "cache paths" from your log, found it used the |
Yeah, that's the problem, it treats absolute paths as relative when it should be treated absolute. That should probably be filed as an issue upstream. I think that means that there's not much left to do with CI after #195, so I'll close this. Thanks for the research! |
CARGO_HOMEis set tobuild/cargo-homewhich is inside the workspace. This folder contains the.../registry/srcfolders. Being inside the workspace makesSwatinem/rust-cacheconsider it local code and thus deletes the built dependencies at job end, regardless of location.Move
CARGO_HOMEoutside the workspace so the rust cache considers the build dependencies as non-local.Helps with #95