pkgxdev / pkgx

the last thing you’ll install
https://pkgx.sh
Apache License 2.0
8.81k stars 1.36k forks source link

Are you sure macOS x86-64 binaries in GitHub releases are x86-64? #1019

Open felipecrs opened 1 week ago

felipecrs commented 1 week ago

I forked pkgx (the cli) so that I can provide my own pkgx binaries with some fixes/improvements I need.

When doing so, I also refactored cd.yaml to not rely on self-hosted ARM64 runners.

I am mentioning this for two reasons:

  1. Maybe you guys want to reuse the same idea to drop the dependency on self-hosted runners as well:

Note that the scripts are as ugly as possible, my only intention was to get it done however I could ASAP.

  1. See this section:

https://github.com/pkgxdev/pkgx/blob/ba219daa68404f4dc6206ffce43f37d5ca25386f/.github/workflows/cd.yml#L61-L62

There's a problem. macos-latest is currently M1 (ARM64). I am wondering if the binary in the GitHub release is in fact a ARM64 binary named as if it was x86-64.

felipecrs commented 1 week ago

Oh, probably not (answering question 2). The latest pkgx release is from January, and I believe GitHub changed this after that.

https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

felipecrs commented 1 week ago

Oh, another note:

dosubot[bot] commented 1 week ago

The macos-latest runner on GitHub is indeed currently an M1 (ARM64) machine. However, the cd.yaml file in the main pkgx repository ensures that the binaries are correctly identified and named based on their architecture. The script uses a case statement to differentiate between ARM64 and x86-64 binaries for both Darwin (macOS) and Linux platforms [1].

Here is the relevant part of the script:

for filename in pkgx-*+*+*.tar.xz; do
  case $filename in
  *+darwin+aarch64.tar.xz)
    go $filename Darwin arm64;;
  *+darwin+x86-64.tar.xz)
    go $filename Darwin x86_64;;
  *+linux+aarch64.tar.xz)
    go $filename Linux arm64
    go $filename Linux aarch64;;
  *+linux+x86-64.tar.xz)
    go $filename Linux x86_64
    ./out/Linux/x86_64 --version | awk '{print $2}' > out/VERSION
    ;;
  esac
done

This ensures that the binaries are correctly processed and named according to their architecture. Additionally, the cd.yaml file has been updated to avoid relying on self-hosted ARM64 runners by using GitHub-hosted runners and QEMU for cross-platform builds [2][3].

To continue talking to Dosu, mention @dosu.

felipecrs commented 1 week ago

@dosubot you went far this time 🤣🤣🤣

dosubot[bot] commented 1 week ago

Glad you found it helpful! If you have any more questions or need further assistance, feel free to ask. 😄

To continue talking to Dosu, mention @dosu.