cargo-run-bin
cargo-run-bin copied to clipboard
GitHub Action to install `cargo-run-bin`
I really like the collective power of cargo-run-bin and https://github.com/cargo-bins/cargo-binstall , which can work well together. However, I'm having issues using them efficiently in GitHub Actions, for a few reasons:
cargo-run-bindoesn't seem to have binaries that can be installed in GitHub Actions runners usingcargo binstall. https://github.com/cargo-bins/cargo-binstall/issues/1551- I think https://github.com/Swatinem/rust-cache messes with caching and can result in non-deterministic failures (here, for example, although the logs aren't public). Somehow it thinks the binary is installed when it's not?
cargo install cargo-run-bintakes significant time, potentially dominating the runtime of a CI job.
This is probably "my fault" for not understanding exactly how to connect all the tooling, but I think this could be a lot more straightforward. It would be really nice to have a GitHub action that installs a pre-compiled cargo-run-bin in a couple of seconds, similar to cargo-binstall (note how the top of the repo links to the action). This would provide a great foundation for writing fast and repeatable CI jobs for Rust.
For example, here are two CI runs of the exact same commit:
I'm sure there are some details I'm missing, but one CI run takes only 29s while the other one spends 26s just on installing cargo-run-bin (based on cache hits/misses that I can't fully explain). Even if the rest of the CI run can take longer, it's especially valuable for the tooling to install super quickly, so that any failure in the actual code is caught as quickly as possible. This can make the difference between seeing a CI failure before starting (or submitting) a PR to one's project, vs. after.
To be clear, I'm not saying cargo-run-bin is doing anything wrong, I'd just really love to see everyone benefit from super fast CI jobs in GitHub Actions using cargo-run-bin in a standard/officially supported way.
There's also quickinstall, which will build cargo-run-bin if it is used widely.
Or I can add it to the list of popular softwares to build, if you don't feel like adding binaries to release.
Hey there!
So I'm down to build binaries for cargo-run-bin, I just need to put in the effort. I take producing third party licenses pretty seriously, and just need to port stuff from other repos first to get it setup.
Swatinem/rust-cache should be able to cache global dependency builds in ~/.cargo, you may just have to selectively state you want it cached. I thought I had it setup on some other projects, but I've missed it and never noticed the run times.
Either way, binary releases sound fun. I'll try to make time.
Fun fact:
@lgarron cargo-quickinstall already builds cargo-run-bin v1.7.2 https://github.com/cargo-bins/cargo-quickinstall/releases/tag/cargo-run-bin-1.7.2
So if you are using cargo-binstall or taiki-e/install-action, it should work out-of-the-box.
Fun fact:
@lgarron cargo-quickinstall already builds cargo-run-bin v1.7.2 https://github.com/cargo-bins/cargo-quickinstall/releases/tag/cargo-run-bin-1.7.2
So if you are using cargo-binstall or taiki-e/install-action, it should work out-of-the-box.
Do you have an example of an workflow that reliably installs cargo-binstall and cargo-run-bin quickly and consistently when Swatinem/rust-cache is also in use? I have yet to find a combination that works without causing some sort of caching issue.
Do you have an example of an workflow that reliably installs cargo-binstall and cargo-run-bin quickly and consistently when Swatinem/rust-cache is also in use? I have yet to find a combination that works without causing
Can you try installing cargo-run-bin first using taiki-e/install-action, then using the rust-cache?