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

Support GitHub Actions aarch64 runners

Open bgilbert opened this issue 11 months ago • 7 comments

GitHub now offers free aarch64 runners. Automatically select the default apk-tools-url and arch to match the CPU architecture of the current runner. Run armv7 and armhf without QEMU on aarch64 runners. For symmetry, allow emulating x86 and x86_64 on aarch64.

Document how to run aarch64 without emulation. Change existing aarch64 examples to ppc64le, to avoid encouraging emulation of aarch64.

Fixes #11.

bgilbert avatar Jan 17 '25 00:01 bgilbert

In my tests, CPU emulation on the aarch64 runners is notably faster than on x86_64, so I've added a commit noting that in the README.

bgilbert avatar Jan 17 '25 02:01 bgilbert

Oh? 32-bit arm is native now? That's real nice.

neheb avatar Jan 18 '25 00:01 neheb

@jirutka: Thank you very much for providing this action. @bgilbert: And thank you for proposing these changes.

Is there any chance this will be considered for merging? I would very much appreciate to be able run this action on GitHub-hosted ARM runners that are now also available for open source projects for free (as in free beer).

mmuetzel avatar Mar 18 '25 13:03 mmuetzel

While this PR is pending, you can run Alpine natively on aarch64 and armv7 with something like:

jobs:
  alpine:
    # Run any emulated CPUs (e.g. riscv64) on aarch64 runners, which appear to be faster
    runs-on: ${{ startsWith(matrix.platform, 'x86') && 'ubuntu-latest' || 'ubuntu-24.04-arm' }}
    strategy:
      matrix:
        # add 'x86_64', 'x86', 'ppc64le', 'riscv64', etc. as desired
        platform: ['aarch64', 'armv7']
    steps:
      - name: Set up Alpine
        uses: jirutka/setup-alpine@v1
        with:
          arch: ${{ matrix.platform }}
          apk-tools-url: ${{ startsWith(matrix.platform, 'x86') && 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' || 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' }}
      - name: Disable QEMU emulation
        if: matrix.platform == 'armv7'
        run: sudo update-binfmts --disable qemu-arm
      # your steps here

bgilbert avatar Mar 18 '25 14:03 bgilbert

@bgilbert: Thank you for the hints.

In some tests on a fork of the SuiteSparse repository, it looked like the Ubuntu on ARM runners were slower in emulating other CPUs than using ubuntu-latest. So, I opted for only using the Ubuntu on ARM runners for armv7. I might have been unlucky and got some particularly slow runners when testing with Ubuntu on ARM. So, I don't know how representative that test was.

mmuetzel avatar Mar 26 '25 15:03 mmuetzel

Okay, thanks for the info. To avoid making a counterproductive change, I've dropped the README recommendation to run emulated CPUs on ARM.

bgilbert avatar Mar 27 '25 06:03 bgilbert

Is there anything I can do to help get this in?

bgilbert avatar Aug 29 '25 06:08 bgilbert

Needs rebasing.

neheb avatar Dec 06 '25 05:12 neheb

Rebased.

@jirutka Would really appreciate if you could take a look.

bgilbert avatar Dec 06 '25 06:12 bgilbert