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

Detect native arch dynamically #11

Open
zacksiri opened this issue Oct 22, 2023 · 3 comments · May be fixed by #22
Open

Detect native arch dynamically #11

zacksiri opened this issue Oct 22, 2023 · 3 comments · May be fixed by #22

Comments

@zacksiri
Copy link

Currently from what I read from the setup script. It seems anything which is not x86 will setup qemu. However in the use case where we're using a self hosted runner that the host is natively aarch64 it should not setup qemu.

@zacksiri
Copy link
Author

zacksiri commented Oct 22, 2023

If you can give me pointers I can probably handle this and submit a PR.

Update:

After some research can't we use uname -m to detect the architecture? If the argument passed in doesn't match we provision qemu.

@joeyparrish
Copy link

I have the same issue. This fails on my arm64 runner, because it can't execute the x86 binaries. And on this line:

if [[ "$INPUT_ARCH" != x86* ]]; then

it sets up qemu for any architecture that isn't x86. Instead, it should set up qemu for any architecture that isn't native.

@joeyparrish
Copy link

Also this default is a problem:

setup-alpine/action.yml

Lines 9 to 15 in 359b91e

apk-tools-url:
description: >
URL of the apk-tools static binary to use. It must end with `#!sha256!` followed by a SHA-256
hash of the file.
This should normally be left at the default value.
required: false
default: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.0/x86_64/apk.static#!sha256!1c65115a425d049590bec7c729c7fd88357fbb090a6fc8c31d834d7b0bc7d6f2

It hard-codes for x86_64 binaries, and requires a sha256 to be valid.

jirutka added a commit that referenced this issue Nov 10, 2024
bgilbert added a commit to bgilbert/setup-alpine that referenced this issue Jan 17, 2025
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 s390x, to avoid encouraging emulation of aarch64.

Fixes jirutka#11.
@bgilbert bgilbert linked a pull request Jan 17, 2025 that will close this issue
bgilbert added a commit to bgilbert/setup-alpine that referenced this issue Jan 17, 2025
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.
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 a pull request may close this issue.

2 participants