Fixed Cargo example not working for multiple archs#1726
Open
Melchizedek6809 wants to merge 4 commits into
Open
Fixed Cargo example not working for multiple archs#1726Melchizedek6809 wants to merge 4 commits into
Melchizedek6809 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Rust/Cargo caching example to avoid cross-architecture cache restores (e.g., ARM runners restoring x86 caches), which can break builds when cached binaries are architecture-specific.
Changes:
- Modify the Cargo example cache key to incorporate runner architecture in addition to OS and
Cargo.lockhash.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Shouldn't |
Author
|
@herrernst Probably, but I haven't done any Swift development and I didn't want to add untested instructions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added runner.arch to the cache key in the Cargo example since otherwise an arm runner might pull an x86 cache which breaks the build. I got the following error without this fix:
Description
It's just a change to the Rust/Cargo example since the action works quite well it's just that the key used in the example does not consider the architecture of the runner which at least for Rust/Linux is quite important.
Motivation and Context
Should help others since they might run into the same error as I did when just copy-pasting the example code, I for example just blindly assumed that runner.os might be something like "ubuntu-24.04" or "ubuntu-24.04-arm" to distinguish between the different architecture.
How Has This Been Tested?
Added the runner.arch part to the cache key for my Rust project and now
Screenshots (if appropriate):
Types of changes
Checklist:
Didn't run the test suite since I only changed a single line in the docs / EXAMPLES.md file.