Skip to content
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

crux-mir-build.yml: Cache cargo dependencies #1314

Merged
merged 2 commits into from
Feb 24, 2025

Conversation

RyanGlScott
Copy link
Contributor

Fixes #1160.

This is anticipation of adding a separate `CARGO_CACHE_VERSION` environment
variable (#62).
Copy link
Contributor

@sauclovian-g sauclovian-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems plausible

@RyanGlScott
Copy link
Contributor Author

Hm, this appears not to be caching things like I would expect them to. I re-ran a job to test the caching, and it did record a cache hit:

Cache hit for: 1-ubuntu-22.04-cargo-cache-Linux-7fbb90a9-31b6338a
Received 25165824 of 507566794 (5.0%), 24.0 MBs/sec
Received 134217728 of 507566794 (26.4%), 63.8 MBs/sec
Received 268435456 of 507566794 (52.9%), 85.0 MBs/sec
Received 402653184 of 507566794 (79.3%), 93.2 MBs/sec
Received 507566794 of 507566794 (100.0%), 96.7 MBs/sec
Cache Size: ~484 MB (507566794 B)
/usr/bin/tar -xf /home/runner/work/_temp/a4e98288-cf8a-4e74-a7a8-c9e5b66d0180/cache.tzst -P -C /home/runner/work/crucible/crucible --use-compress-program unzstd
Cache restored successfully
Restored from cache key "1-ubuntu-22.04-cargo-cache-Linux-7fbb90a9-31b6338a" full match: true.

On the other hand, when it installs mir-json, it recompiles all of its dependencies!

   Compiling libc v0.2.126
   Compiling pkg-config v0.3.17
   Compiling autocfg v0.1.7
   Compiling cfg-if v0.1.10
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.96
   Compiling quote v1.0.2
   Compiling jobserver v0.1.24
   Compiling cc v1.0.83
   ...

I wonder if I have misconfigured something with the rust-cache action?

@RyanGlScott RyanGlScott force-pushed the T1160-cache-cargo-build-artifacts branch from 37d6279 to d3e4f8d Compare February 24, 2025 21:31
@RyanGlScott
Copy link
Contributor Author

I fixed this by adding a workspaces: "dependencies/mir-json" field to the action's stanza in the YAML file, which allows rust-cache to figure out what to cache.

@RyanGlScott RyanGlScott merged commit 9aa07ee into master Feb 24, 2025
32 checks passed
@RyanGlScott RyanGlScott deleted the T1160-cache-cargo-build-artifacts branch February 24, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: Cache cargo build artifacts when building mir-json
2 participants