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

GitHub Action to install cargo-run-bin #21

Open
lgarron opened this issue Jan 15, 2024 · 6 comments
Open

GitHub Action to install cargo-run-bin #21

lgarron opened this issue Jan 15, 2024 · 6 comments

Comments

@lgarron
Copy link

lgarron commented Jan 15, 2024

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:

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.

lgarron added a commit to cubing/cubing.rs that referenced this issue Jan 15, 2024
This more than doubles the CI runtime, but I think that's okay to avoid CI failures for now.

Perhaps dustinblackman/cargo-run-bin#21 can lead to something more reliable.
@lgarron
Copy link
Author

lgarron commented Jan 15, 2024

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.

@NobodyXu
Copy link

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.

@dustinblackman
Copy link
Owner

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.

@NobodyXu
Copy link

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.

@lgarron
Copy link
Author

lgarron commented Jan 22, 2024

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.

@NobodyXu
Copy link

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?

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

No branches or pull requests

3 participants