ruby / setup-ruby

An action to download a prebuilt Ruby and add it to the PATH in 5 seconds

Home Page:https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux ARM support

sandstrom opened this issue · comments

Now that Github Actions has ARM-runners (in private beta currently), it would be awesome if this action would support ARM too.

Right now, it seems to assume Github doesn't have ARM.

https://github.com/ruby/setup-ruby/blob/master/common.js#L165

Here is a signup link for the private beta:

https://resources.github.com/devops/accelerate-your-cicd-with-arm-and-gpu-runners-in-github-actions/

What's needed to support it? Seems tricky to support it when the docs for it are still private?

Good question!

@dentarg If you would like to, I'm sure @lkfortuna (PM working with Github Actions) can get you into the beta, since this action is widely used.

I was thinking in general, if you have access to the beta, you should be able to submit a PR to this repo to show what needs to be done?

I've been invited to the beta (but haven't gotten access to the docs), I actually just emailed her earlier today ;-)

@dentarg Ah, got it!

I would love to help out, but I don't know the details of this action well enough, sorry.

Ever heard about "learning by doing"? :-)

If you don't dig in yourself here, don't expect any movement on this until after the private beta.

It's the same as for any other new runner, we need access to the runner from the ruby organization to build binaries, see #494 (comment)
Until then linux-aarch64 will be detected as self-hosted, because there are no prebuilt Rubies for it available.

So @lkfortuna @Steve-Glass could you make these new beta linux-aarch64 runners available for the ruby organization?
What would be the runs-on value?

@dentarg Yeah, I know 😄

I've learned a lot by doing things (self-thought), just that I haven't yet spent that much time with JS-based Github Actions.

I do contribute to a few open-source projects, but I have to pick, and currently my goal is to improve the ipaddress gem.

Out of curiosity, do you live in the Stockholm area, or elsewhere? 🇸🇪

@eregon - Thanks for reaching out. Let me bring this feedback to the team and we will get back to you next week.

@lkfortuna @Steve-Glass Somewhat off topic, but is there a reason why the setup-python and setup-node actions are managed by Github, but this action lives outside?

^ Because https://github.com/actions/setup-ruby was not actively maintained and provided too little functionality to be practical (e.g. no way to specify Ruby x.y.z, only latest x.y and only 3-4 versions available).

hi @eregon and chat, I came around this discussion with a similar requirement for arm-based ruby installation. but I'm using self-hosted runners and not GitHub provided. For the base OS, I rely on Ubuntu 20.04-arm64 OS. Ruby binaries for arm64 for ubuntu20.04 are also publicly available. Wouldn't using those for ruby setup in arm-based Ubuntu/Linux OS allow GitHub runners (in beta) to run?

@cb-krishnapatel The builds need to be tested automatically, so we need access to these runners and the builds must happen on GitHub runners to ensure it's exactly the same image with the same tweaks, packages installed, etc.

Regarding https://ubuntu.pkgs.org/20.04/ubuntu-main-arm64/ruby_2.7+1_arm64.deb.html (the system package), of course you can apt-get install ruby, but that will only give you the ruby version that Ubuntu 20.04 ships and no other.

Agreed and acknowledged @eregon

FYI: I requested this to GitHub support for Arm runner as private beta on Ruby organization.

I'm working on this on the Heroku side right now heroku/docker-heroku-ruby-builder#38. Having support for ARM from ruby/setup-ruby isn't a blocker there, but it's what prompted me to see if an issue was raised yet or not.

@hsbt have you heard back from the request?

I managed to get this action to work on GitHub's ARM-based runners. Initially, what I needed to edit in this action was relatively small but as there are no pre-built ruby for ARM architecture, I ended up having to add should-install-with-ruby-build option as well.

I guess, if we start building for ARM as well, the download urls can be:

https://github.com/ruby/${engine}-dev-builder/releases/latest/download/${engine}-${version}-${platform}.tar.gz

where platform is ubuntu-22.04 or ubuntu-22.04-arm (not sure if we can name x64 version as ubuntu-22.04-x64. Probably, it'll break stuff).

Anyway, my changes can be seen here: b4b-payments@e0facb5. I'd be happy to make PRs for both repos if one of the maintainers weigh in to know the preferred way to approach this.

Gotchas:

The provided image (ubuntu-22.04) does not behave exactly as the ones that are currently in production for x64. A lot of packages are missing (expected as github has documented) but I had to do the following to get this action to install ruby:

          sudo mkdir -p /opt/hostedtoolcache
          sudo chown -R $USER /opt/hostedtoolcache

Basically, it looks like /opt/hostedtoolcache is not present which is a hardcoded value in this action.

@everplays While that diff is small it has the big disadvantage to have to compile CRuby from source every time (takes many minutes) and needing to manually install extra packages, and misses some other tweaks done in https://github.com/ruby/ruby-builder/blob/master/.github/workflows/build.yml.

Until the ruby organization has access to these new linux arm runners, I think there is nothing we can do.
@Steve-Glass Any news on that front?

indeed, as I said, we'd need to alter ruby-builder repo to build the ARM binary as well. If someone weights in, I can make the changes for that repo too so a full build won't be necessary. :-)

Unfortunately, ruby org couldn't enable ARM runner with private beta. We need to wait until GA status.

Recently, macos-latest seems to have become macos-14 running on M1.
CIs using older versions of ruby are failing because they can't be downloaded.

@nobu Could you file a separate issue, with links to the failed workflows?
This one is about linux-aarch64, not macOS.