setup-ruby icon indicating copy to clipboard operation
setup-ruby copied to clipboard

Linux ARM support

Open sandstrom opened this issue 1 year ago β€’ 38 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/

sandstrom avatar Mar 15 '24 09:03 sandstrom

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

dentarg avatar Mar 15 '24 11:03 dentarg

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.

sandstrom avatar Mar 15 '24 12:03 sandstrom

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 avatar Mar 15 '24 13:03 dentarg

@dentarg Ah, got it!

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

sandstrom avatar Mar 15 '24 14:03 sandstrom

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.

dentarg avatar Mar 15 '24 15:03 dentarg

It's the same as for any other new runner, we need access to the runner from the ruby organization to build binaries, see https://github.com/ruby/setup-ruby/pull/494#issuecomment-1743537651 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?

eregon avatar Mar 15 '24 16:03 eregon

@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? πŸ‡ΈπŸ‡ͺ

sandstrom avatar Mar 15 '24 17:03 sandstrom

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

Steve-Glass avatar Mar 15 '24 17:03 Steve-Glass

@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?

sandstrom avatar Mar 15 '24 17:03 sandstrom

^ 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).

eregon avatar Mar 15 '24 19:03 eregon

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 avatar Mar 16 '24 16:03 cb-krishnapatel

@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.

eregon avatar Mar 16 '24 18:03 eregon

Agreed and acknowledged @eregon

cb-krishnapatel avatar Mar 16 '24 18:03 cb-krishnapatel

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

hsbt avatar Mar 18 '24 01:03 hsbt

I'm working on this on the Heroku side right now https://github.com/heroku/docker-heroku-ruby-builder/pull/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?

schneems avatar Mar 25 '24 19:03 schneems

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: https://github.com/b4b-payments/setup-ruby/commit/e0facb59cd8373d1983af06d925bada2e344bfa6. 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 avatar Apr 09 '24 10:04 everplays

@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?

eregon avatar Apr 09 '24 10:04 eregon

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. :-)

everplays avatar Apr 09 '24 10:04 everplays

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

hsbt avatar Apr 19 '24 09:04 hsbt

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 avatar Apr 30 '24 03:04 nobu

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

eregon avatar May 03 '24 10:05 eregon

Looks like these runners have moved into public beta: https://github.blog/changelog/2024-06-03-actions-arm-based-linux-and-windows-runners-are-now-in-public-beta/

npezza93 avatar Jun 03 '24 19:06 npezza93

From https://github.blog/2024-06-03-arm64-on-github-actions-powering-faster-more-efficient-build-systems/

We expect to begin offering Arm runners for open source projects by the end of the year.

So it looks like linux-arm64 runners won't be available as GitHub-Hosted runners for public repositories until then.

eregon avatar Jun 03 '24 21:06 eregon

Is the paid-only status of ARM support a deal breaker for this project?

xrl avatar Jun 05 '24 16:06 xrl

Yes, see the above quote from the announcement

dentarg avatar Jun 05 '24 18:06 dentarg

Is the paid-only status of ARM support a deal breaker for this project?

I think similar 'issues' happened with macOS ARM. GitHub/MSFT adds a new platform for 'Enterprise' customers, and later make it available to OSS projects.

The one problem is the CI infrastructure's 'dependencies' come from OSS orgs. Most of the Ruby CI infrastructure for Ubuntu and macOS is contained in the Ruby organization, but some of the Windows infrastructure is not...

MSP-Greg avatar Jun 05 '24 19:06 MSP-Greg

The only way to add linux-aarch64 support earlier is if GitHub provides free linux-aarch64 runners for the ruby organization, like it was done for macos-arm64 with macos-arm-oss (https://github.com/ruby/setup-ruby/issues/577#issuecomment-2000066452). @Steve-Glass Any chance to make that happen?

eregon avatar Jun 05 '24 20:06 eregon

It's possible to use qemu to run aarch64 and arm workloads on the normal linux runners. See https://github.com/flavorjones/ruby-c-extensions-explained/blob/main/.github/workflows/precompiled.yml#L172-L179 for an example of how this is done for many C extension projects.

The builds will be slower than bare metal (because it's an emulator) but the tests will run.

flavorjones avatar Jun 05 '24 21:06 flavorjones

QEMU is so amazingly, painfully slow. And also a huge pain to set up.

xrl avatar Jun 07 '24 17:06 xrl

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

πŸ‘‹ apologies, but any update here now that it's available? I'm unfortunately trying to still support an older ruby version with the new runners atm

NicoHinderling avatar Jun 26 '24 01:06 NicoHinderling