Scan content of $CARGO_HOME/bin on restore instead of relying on cargo install metadata #325
Open
clechasseur wants to merge 1 commit intoSwatinem:masterfrom
Open
Scan content of $CARGO_HOME/bin on restore instead of relying on cargo install metadata #325clechasseur wants to merge 1 commit intoSwatinem:masterfrom
$CARGO_HOME/bin on restore instead of relying on cargo install metadata #325clechasseur wants to merge 1 commit intoSwatinem:masterfrom
Conversation
Instead of relying on `.crates2.json` to know which binaries are installed, scan the bin directory and save the result in the action's state.
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.
The current implementation of
getCargoBinsto check which binary is installed in$CARGO_HOME/binchecks the content of$CARGO-HOME/.crates2.jsonto determine which binary is preinstalled. When saving cache, all binaries not found in that file are removed to avoid caching them.This means, however, that anything installed via a mean other than
cargo install(like for example viacargo-binstall) won't be cached.This PR changes the logic: now, when restoring cache, the
$CARGO_HOME/bindirectory is scanned and all files there are kept in the action state. When saving the cache post-install, all binaries that were in the directory at the beginning are removed; all others are cached. This allows the use of something likecargo-binstallortaiki-e/install-action, while still benefiting from caching.I've also added a new workflow to test with
cargo-binstall.Let me know if there's something I should update as well.