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

Merge cache-cargo-install-action #66

Open
1 of 2 tasks
taiki-e opened this issue Feb 8, 2023 · 2 comments
Open
1 of 2 tasks

Merge cache-cargo-install-action #66

taiki-e opened this issue Feb 8, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@taiki-e
Copy link
Owner

taiki-e commented Feb 8, 2023

As said in #54 (comment), I would like to merge cache-cargo-install-action into install-action.

Ideally, I would like to merge cache-cargo-install-action into install-action, run cargo-binstall with --disable-strategies compile, and use cache-cargo-install-action when the installation fails, though...

TODO:

@taiki-e taiki-e added the enhancement New feature or request label Feb 8, 2023
@NobodyXu
Copy link
Collaborator

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.

@NobodyXu
Copy link
Collaborator

Regarding $CARGO_HOME, there's one catch though.

There's a PR in cargo-binstall to support install.root in $CARGO_HOME/config.toml cargo-bins/cargo-binstall#884 which can overrides where the binaries are installed and manifests are updated.

elasticdog added a commit to EarthmanMuons/rustops-blueprint that referenced this issue May 5, 2023
The order matters here since rust-cache cleans out any files in
`~/.cargo/bin` that were present **before the action ran**, which means
we'll want to install nextest **after** running the cache job. The
install-action job will check for newer versions appropriately.

The one thing I'm not sure about is if rust-cache will key based off
of the contents of the `~/.cargo/bin` directory, or if it's just saving
that into the cache. If it does key off of the contents, we may need
to always install nextest even if it's not going to be used (for check/
format/lint jobs) so we can maintain cache efficiency.

See:
- https://github.com/Swatinem/rust-cache#cache-details
- taiki-e/install-action#66
github-merge-queue bot pushed a commit to EarthmanMuons/rustops-blueprint that referenced this issue May 5, 2023
The order matters here since rust-cache cleans out any files in
`~/.cargo/bin` that were present **before the action ran**, which means
we'll want to install nextest **after** running the cache job. The
install-action job will check for newer versions appropriately.

The one thing I'm not sure about is if rust-cache will key based off
of the contents of the `~/.cargo/bin` directory, or if it's just saving
that into the cache. If it does key off of the contents, we may need
to always install nextest even if it's not going to be used (for check/
format/lint jobs) so we can maintain cache efficiency.

See:
- https://github.com/Swatinem/rust-cache#cache-details
- taiki-e/install-action#66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants