Open taiki-e opened 1 year ago
Related: The binaries installed via cargo-binstall
can also be cached.
cargo-binstall
by default, installs binaries to $CARGO_HOME
and then updates $CARGO_HOME/.crates.toml
and $CARGO_HOME/binstall/crates-v1.json
.
So if you cache $CARGO_HOME/{bin, .crates.toml, binstall/crates-v1.json}
, then you can also cache result of cargo-binstall
if the binaries is up-to-date.
If a new version has released, then cargo-binstall
will detect that and upgrade the binaries if the version_requirement is empty (default to *
) or *
, >=$VERSION
, since cargo-binstall
would always hit https://crates.io to find out the max_stable_version
for the crate.
In the case of upgrade, you can detect that by checking the hash of the .crates.toml
and then invalidates the cache.
Regarding $CARGO_HOME
, there's one catch though.
There's a PR in cargo-binstall
to support install.root
in $CARGO_HOME/config.toml
https://github.com/cargo-bins/cargo-binstall/pull/884 which can overrides where the binaries are installed and manifests are updated.
As said in https://github.com/taiki-e/install-action/pull/54#issuecomment-1383149339, I would like to merge cache-cargo-install-action into install-action.
TODO: