Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Use @actions/tool-cache in Cargo.installCached #31

Closed
alex opened this issue Nov 23, 2019 · 2 comments · Fixed by #92
Closed

Use @actions/tool-cache in Cargo.installCached #31

alex opened this issue Nov 23, 2019 · 2 comments · Fixed by #92

Comments

@alex
Copy link
Contributor

alex commented Nov 23, 2019

There's a TODO for this, but I figured it might be helpful to have an issue for this:

* TODO: We can utilize the `@actions/tool-cache` and cache installed binary.
* As for now it acts just like an stub and simply installs the program
* on each call.

The lack of caching makes cargo-audit very very slow :-(

I haven't played with @actions/tool-cache yet myself, but I imagine the solution is roughly calling tc.find(), if it returns something copy it to the right place, otherwise run the install and then call tc.cacheFile().

@svartalf
Copy link
Member

svartalf commented Nov 23, 2019

Hey, @alex, thanks for reminder, this thing definitely need a tracking issue.
Any executed cargo install {pkg} is slow right now, for example, same goes to actions-rs/cargo Action with use-cross: true input enabled, as it compiles cross on each execution.

This comment is a bit outdated, though, it seems that @actions/tool-cache package hardly can be applied here, as it is expected that the downloaded tool can be executed immediately, which is not the case for executables installed via the cargo install, as we need to compile them.

It might be possible to provide download URLs for some cargo subcommand (let's say, download it from the GitHub releases page, like with a tarpaulin code coverage tool), but it is not very handy and can't be applied to all possible options (cargo-audit being one of them), so we will end with the compilation once again.

I would like to add an opaque cache for compiled subcommands with the simple "if it is not in cache yet, compile it and put it in there" flow, but at the moment it is blocked by actions/cache#55
Cached tools might be evicted from the cache eventually and will eat some of that precious available cache space (~few megabytes per subcommand), but it seems to be the best option so far, as soon as linked issue will be resolved.

@nickelc
Copy link
Contributor

nickelc commented Dec 27, 2019

I'm working on GitHub release installers for some commands (cargo-make, cargo-web, mdbook).
https://github.com/nickelc/actions-rs-core/tree/installers

The installers use @actions/tool-cache to download and put the binary into the tool cache but a persistent cache is only supported on self-hosted runners.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants