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

Create official Rust setup GitHub Action? #3409

Open
jcbhmr opened this issue Jul 15, 2023 · 14 comments
Open

Create official Rust setup GitHub Action? #3409

jcbhmr opened this issue Jul 15, 2023 · 14 comments

Comments

@jcbhmr
Copy link

jcbhmr commented Jul 15, 2023

Problem you are trying to solve

There's a lot of different Rust setup actions on GitHub Actions Marketplace:
image
https://github.com/marketplace?type=actions&query=setup+rust+

This dilutes the "truly good" ones because there's no well-known "good" one. The @actions-rs -- the most comprehensive org with the most users it seemed -- lead maintainer seems to be no longer active, and there's not really a good "best choice" replacement that I could find.

In short, the ecosystem is splintered. This is bad for beginners like me who just want to install the latest Rust version. (can you tell I'm a bit miffed? 🤣) Similar to how Deno has an official https://github.com/denoland/setup-deno action and Ruby has https://github.com/ruby/setup-ruby and so on, I think that some kind of setup-rust action would be a good idea.

I don't know if this is the right place to suggest such a thing, but I figured: hey, it's worth a shot!

Solution you'd like

If nothing else and this idea is out-of-scope for maintenance reasons, I'd at least like to see some kind of documentation pointer to 1 or 2 recommended GitHub Actions on maybe https://rustup.rs/ (cause that's where you go to install rust, right?) or maybe somewhere else? idk

If it's possible, you might also be able to convince @actions 👈 the https://github.com/actions org to add a setup-rust action. idk about that tho, that's even more far-fetched than a @rust-lang/setup-rust action...

I think it would be in the realm of plausibility to ask one of the various action authors 👆 from that big list (or even more than one of you could politically manage it) to bring the best action under the @rust-lang umbrella. That might actually be the most practical idea? 🤔 Or maybe not idk.

Notes

Sorry if I'm asking about this in the wrong place. Or if this idea is vastly out of scope. I just really think that having one good way to do this very common thing is a good idea.

Heck, even some of the @rust-lang repositories have this same issue! 😱

https://github.com/rust-lang/libc/blob/fab4a56f7265333f25bd6484784865c7bf513efa/.github/workflows/main.yml#L24-L29

    steps:
      - uses: actions/checkout@v3
      - name: Setup Rust toolchain
        run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh  # 👈🔴🔴
      - name: Execute run-docker.sh
        run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}

And there's 90+ matches for a search of "rustup" used in GitHub Actions for @rust-lang: https://github.com/search?q=org%3Arust-lang+rustup+%28path%3A.github%2Fworkflows%2F*.yml+OR+path%3A.github%2Fworkflows%2F*.yaml%29&type=code

image
👆 this is the kinda thing that I'd love for an official @rust-lang/setup-rust or @rust-lang/setup-rustup or something action to solve.

@dawnofmidnight
Copy link

dawnofmidnight commented Jul 24, 2023

I don't think this is necessary because, as visible in the rust-lang/rust-analyzer repository, rustup seems to be installed by default on the github actions runners. There's no rustup installation step there.

https://github.com/rust-lang/rust-analyzer/blob/99718d0c8bc5aadd993acdcabc1778fc7b5cc572/.github/workflows/ci.yaml#L63-L67

@rbtcollins
Copy link
Contributor

I think we have a lot of history out there as things have evolved over time, and now rustup is perhaps more pervasive than it was.

Rustup is definitely in the official runner images: https://github.com/search?q=repo%3Aactions%2Frunner-images%20rustup&type=code even though it is not documented in their README today.

Perhaps getting rustup documented more visibly by Github would be a good route forward?

@djc
Copy link
Contributor

djc commented Aug 14, 2023

@jcbhmr as an experienced Rust maintainer, just wanted to say that I'm seeing all the repositories I'm participating in migrate to dtolnay/rust-toolchain.

@rami3l
Copy link
Member

rami3l commented Aug 18, 2023

just wanted to say that I'm seeing all the repositories I'm participating in migrate to dtolnay/rust-toolchain

@djc Yup, I'm using @dtolnay's workflow as well since I know it's becoming the "de facto" option.

However, I do wonder where my knowledge of this comes from, since something is clearly missing, otherwise @jcbhmr should also know about it... Or it needs some more promotion in a certain way?

@jcbhmr
Copy link
Author

jcbhmr commented Aug 18, 2023

@djc @rami3l The action it you're referring to: https://github.com/dtolnay/rust-toolchain
doesn't seem to appear in my naive search for "setup rust" https://github.com/marketplace?type=actions&query=setup+rust+ or even https://www.google.com/search?q=setup+rust+github+actions

as you mentioned it becoming the "de facto": a beginner like me has no idea what the de facto is because its not really listed anywhere...

when you search https://www.google.com/search?q=rust+github+actions you get @actions-rs, not the https://github.com/dtolnay/rust-toolchain. imo the best-case scenario here is one of:

  • an official @rust-lang action to solidify it as THE best choice (you could even transfer/import from said community de-facto one idk)
  • somehow reviving @actions-rs(?) since its top SEO
  • an official @actions setup-rust action

👆 all that is from the perspective of a user who is completely oblivious to the complicated people-problems or other management issues with accomplishing any of those tasks

from a more conscientious perspective, you mentioned more promotion: maybe on https://rustup.rs or some other official installation place? this could go a ways to cementing a particular action as the recommended one.

@rami3l
Copy link
Member

rami3l commented Aug 18, 2023

@jcbhmr Discoverability issues are indeed easier to be identified by newcomers like you, thanks a lot for your detailed feedback!

@jcbhmr
Copy link
Author

jcbhmr commented Aug 18, 2023

@dawnofmidnight @rbtcollins you mentioned that rustup is available on github actions runners. this is true! and its awesome! 🙌 ...but take nodejs, another popular tool: its already installed at v18 the latest LTS on all github actions runners. and yet there's still a full https://github.com/actions/setup-node which does MORE THINIGS like configuring magic caching and registry and node-version-file etc. ...but that might be out of scope idk 🤷‍♀️.

even other smaller projects like oras are included in the github runner images https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#cli-toolsbut still provide things like https://github.com/oras-project/setup-oras to make version pinning configuration etc. easier.

i guess what I'm saying is there's a lot of convention around having official-ish setup actions. deno has one https://github.com/denoland/setup-deno even though its just a curl | sh. node has one https://github.com/actions/setup-node even though its already there. ocaml has one https://github.com/ocaml/setup-ocaml etc etc. and right now there's not a clear obvious one way to do it for rust. you've got the builtin toolchain, but then no caching. you've got @actions-rs but that's unmaintained. you've got various others https://www.google.com/search?q=setup+rust+action+github but there's so many and no top-dog one.

slightly off topic: to provide an example of a community project becoming official https://github.com/denolib/setup-deno became the official deno action https://github.com/denoland/setup-deno! its happened! just pointing that out 🤣

@rami3l
Copy link
Member

rami3l commented Aug 18, 2023

I need an action to setup Rust as well because sometimes my actions happen in a custom Docker image.

FWIW I found out the thread that led me to dtolnay's workflow: actions-rs/toolchain#221. I'd been happily using @action-rs' one for quite a while until it didn't work anymore.

@rbtcollins
Copy link
Contributor

@rami3l OTOH you could build your custom Docker image to have rustup already installed, as part of giving it parity with github runners, no? (rustup-init --default-toolchain=none).

@jcbhmr I use https://github.com/marketplace/actions/rust-cache with many projects, because the caching glue is very nice and hard to replicate.

I think the actions-rs org showed that there are many interesting actions (and more outside that org too - see the awesome-list present in the org).

The salient questions are:

  • should rust-lang host one, or more than one, actions?
  • if yes, should the rustup repository be the home for said actions

I don't have a strong view on the first one - on the one hand I'm skeptical of centralising things just-because, but on the other hand discoverability is indeed a challenge sometimes.

On the second one though, there is a very clear answer: 'no'. Github requires dedicated repositories for actions published to their marketplace.

So, this bug cannot be fixed here, ever. Making a new repository and all of that is also out of scope for the rustup bug tracker. I haven't ever gone through doing that so I can't even advise effectively!

I suggest reaching out to the infra team and discuss with them, if you decide to drive such a project.

I'm ok with leaving this bug open a little while as a place for you-all to coordinate, but longer term it needs to be transferred to a more appropriate repo, or closed.

@Xuanwo
Copy link

Xuanwo commented Dec 28, 2023

I'm not sure why we need a setup-rust action when rustup is already installed and up to date. A rust-toolchain.toml file should suffice for most scenarios. For more complex situations, users can simply run rustup toolchain add nightly.

Perhaps users are seeking a more powerful feature that allows them to enable caching with a simple cache: true?


you mentioned that rustup is available on github actions runners. this is true! and its awesome! 🙌 ...but take nodejs, another popular tool: its already installed at v18 the latest LTS on all github actions runners. and yet there's still a full https://github.com/actions/setup-node which does MORE THINIGS like configuring magic caching and registry and node-version-file etc. ...but that might be out of scope idk 🤷‍♀️.

The difference is github action runner install rustup instead of just rustc 1.74. And we have rust-toolchain.toml that can pick correct toolchain to run.

@jcbhmr
Copy link
Author

jcbhmr commented Dec 28, 2023

To be more specific about what's missing from "just use rustup its already there":

  • caching rust toolchain installations to $RUNNER_TOOL_CACHE
  • caching built rust dependencies/artifacts based on Cargo.lock

👆 those are the problems that a rust-lang/setup-rust should solve 😉

along with a bunch of other multi-line command features being collapsed into a single YAML with: config object:

  • use rust-toolchain file or ignore it?
  • whether to fetch and use latest version or not
  • use specific custom version of rust toolchain/rustc/etc.
  • install specific targets in addition
  • change path to Cargo.lock used for cache
  • configure default Cargo registry url
  • probably more im missing 🤷‍♀️

@antoyo
Copy link

antoyo commented Jan 12, 2024

Annotations is another big feature that a rust action could provide.

@Veetaha
Copy link

Veetaha commented Jan 13, 2024

Hey, I found this issue thanks to Reddit.

I suggested there to consider moving actions-rust-lang/setup-rust-toolchain under the official rust-lang org, so that it could get more attention. I wonder what @jonasbb (supposedly the author of this awesome action) thinks about it.

At the very least docs that people go to when installing rust could promote this action.

@rami3l
Copy link
Member

rami3l commented Jan 17, 2024

FWIW @Manishearth is considering the option of creating a separate team for maintaining official GitHub Actions:
https://rust-lang.zulipchat.com/#narrow/stream/301329-t-devtools/topic/Having.20a.20CI.20subteam.3F

We could definitely use some help in this respect, so feel free to chime in if you're interested!

sirhcel added a commit to sirhcel/serialport-rs that referenced this issue May 12, 2024
The previously used actions from actions-rs seem to be no longer
maintained. Following the discussion in
rust-lang/rustup#3409, this is one way to go.
sirhcel added a commit to sirhcel/serialport-rs that referenced this issue May 12, 2024
The previously used actions from actions-rs seem to be no longer
maintained. Following the discussion in
rust-lang/rustup#3409, this is one way to go.
sirhcel added a commit to sirhcel/serialport-rs that referenced this issue May 12, 2024
There were recently a lot of hiccups with installing rustup for Windows
in CI and the previously used actions from actions-rs seem to be no
longer maintained. Following the discussion in
rust-lang/rustup#3409, this is one way to go.
eldruin pushed a commit to serialport/serialport-rs that referenced this issue May 13, 2024
There were recently a lot of hiccups with installing rustup for Windows
in CI and the previously used actions from actions-rs seem to be no
longer maintained. Following the discussion in
rust-lang/rustup#3409, this is one way to go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants