Skip to content

Conversation

@bgilbert
Copy link
Contributor

@bgilbert bgilbert commented Jan 17, 2025

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
Copy link
Contributor Author

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.

@neheb
Copy link

neheb commented Jan 18, 2025

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

@mmuetzel
Copy link

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

@bgilbert
Copy link
Contributor Author

bgilbert commented Mar 18, 2025

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

@mmuetzel
Copy link

mmuetzel commented Mar 26, 2025

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

@bgilbert bgilbert force-pushed the aarch64 branch 3 times, most recently from 629a160 to 3e0ad9d Compare March 27, 2025 06:46
@bgilbert
Copy link
Contributor Author

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

@bgilbert
Copy link
Contributor Author

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

@neheb
Copy link

neheb commented Dec 6, 2025

Needs rebasing.

GitHub now offers free aarch64 runners:

    https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/

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 jirutka#11.
@bgilbert
Copy link
Contributor Author

bgilbert commented Dec 6, 2025

Rebased.

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

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

Successfully merging this pull request may close these issues.

Detect native arch dynamically

3 participants