pkgx icon indicating copy to clipboard operation
pkgx copied to clipboard

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

Open felipecrs opened this issue 1 year ago • 5 comments

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:
  • https://github.com/felipecrs/pkgx/blob/4ba6b22c67bac8e12ca1a90c5e7ca7ae375e5181/.github/workflows/cd.yml
  • https://github.com/felipecrs/pkgx/blob/4ba6b22c67bac8e12ca1a90c5e7ca7ae375e5181/scripts/build-binaries.sh

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 avatar Jun 28 '24 00:06 felipecrs

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 avatar Jun 28 '24 01:06 felipecrs

Oh, another note:

  • I have absolutely no intention to keep maintaining such pkgx fork. I created it solely for my own needs. I hope the fixes gets merged in the main repo and I can get rid of my fork.

felipecrs avatar Jun 28 '24 01:06 felipecrs

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.

dosubot[bot] avatar Jun 28 '24 01:06 dosubot[bot]

@dosubot you went far this time 🤣🤣🤣

felipecrs avatar Jun 28 '24 01:06 felipecrs

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.

dosubot[bot] avatar Jun 28 '24 01:06 dosubot[bot]

@jhheider I believe the os: key is not relevant here right?

On the topic of making your own binaries for pkgx to consume, we'd like a flexible way to support that at some point for sure.

mxcl avatar Sep 06 '24 15:09 mxcl

This was because GitHub changed the macros-latest runners to arm64. Was addressed in brewkit.

jhheider avatar Sep 06 '24 15:09 jhheider

Should be ok now. If it wasn’t x64 then pantry builds would be failing.

mxcl avatar Sep 08 '24 09:09 mxcl