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

macOS arm64 build #8

Merged
merged 6 commits into from
Oct 27, 2023
Merged

macOS arm64 build #8

merged 6 commits into from
Oct 27, 2023

Conversation

segevfiner
Copy link

@segevfiner segevfiner commented Oct 25, 2023

Fixes #5. We should test the resulting binaries of course.

@segevfiner segevfiner mentioned this pull request Oct 25, 2023

- run: yarn install --ignore-engines

- run: yarn start --node-range node${{ matrix.target-node }} --arch arm64 --output dist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? Is it actually compiling the node binary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's what the scripts in this package do. As far as I remember.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that script coming from the https://github.com/actions/setup-node/tree/main/src. I'm not super familiar with GitHub Actions, where can I find the source for what the actual script is?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. https://github.com/yao-pkg/pkg-fetch/blob/main/lib/build.ts, with the actual entry point defined in package.json.

This entire repo is essentially a script/package to build and fetch patched node binaries suitable for pkg.

Copy link
Member

@robertsLando robertsLando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this could work if gh actions runner is not an arm64...

@segevfiner
Copy link
Author

I don't understand how this could work if gh actions runner is not an arm64...

Cross compilation You can build arm64 binaries on Intel macs with new enough macOS and compiler versions.

@segevfiner
Copy link
Author

I don't understand how this could work if gh actions runner is not an arm64...

Cross compilation You can build arm64 binaries on Intel macs with new enough macOS and compiler versions. Also see https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary.

Comment on lines 58 to 61
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use matrix.target-node

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's only the node version that is used for running the build script and doesn't matter as long as its new enough to run it. No need to vary it per target-node.

Copy link
Member

@robertsLando robertsLando Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least use 18/20 as it's the currently lts

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Probably should update this for all the jobs.

@robertsLando
Copy link
Member

I would like you to manually trigger this action on your fork so I can test if the binary is really an arm64 or not

@segevfiner
Copy link
Author

I would like you to manually trigger this action on your fork so I can test if the binary is really an arm64 or not

I did, but for some reason, although the job took a while, I can't see the build output and it didn't save the artifact. I'm not sure what's wrong running it there. https://github.com/segevfiner/pkg-fetch/actions/runs/6640925313

@robertsLando
Copy link
Member

@segevfiner As you can see the upload artifact step is skipped this means the output is not found, strange that no output is shown when building nodejs binaries, I can actually see it when I use it here: https://github.com/yao-pkg/pkg-binaries/actions/runs/6613054379/job/17960133505#step:4:22

@segevfiner
Copy link
Author

@segevfiner As you can see the upload artifact step is skipped this means the output is not found, strange that no output is shown when building nodejs binaries, I can actually see it when I use it here: https://github.com/yao-pkg/pkg-binaries/actions/runs/6613054379/job/17960133505#step:4:22

Any idea why? I want to see the output to see if it actually built anything or what failed?

@robertsLando
Copy link
Member

Any idea why? I want to see the output to see if it actually built anything or what failed?

Sincerly I have no idea, try to run the action with debug turn on maybe? Or maybe it's because of some env var

@segevfiner
Copy link
Author

Any idea why? I want to see the output to see if it actually built anything or what failed?

Sincerly I have no idea, try to run the action with debug turn on maybe? Or maybe it's because of some env var

Running it again seems to have shown the output 🤷‍♂️

I'll see if I can get it working for real now.

@robertsLando
Copy link
Member

robertsLando commented Oct 26, 2023

I'll see if I can get it working for real now.

👍🏼 LMK

@segevfiner
Copy link
Author

@robertsLando https://github.com/segevfiner/pkg-fetch/actions/runs/6656756096

@robertsLando
Copy link
Member

Well done @segevfiner !

@robertsLando robertsLando merged commit 8f8986f into yao-pkg:main Oct 27, 2023
5 checks passed
@robertsLando
Copy link
Member

Once this is done (it usually takes 6h) I will bump expected sha, pkg fetch and pkg

https://github.com/yao-pkg/pkg-fetch/actions/runs/6664583716

@CMCDragonkai
Copy link

@robertsLando it succeeded! Can we get a new release! This is awesome!!

@robertsLando
Copy link
Member

It's already out! Check latest @yao-pkg/pkg

@CMCDragonkai
Copy link

Cool, but I was referring to the actual binary output that should be a new release on this repository as it is currently still 3.5. I integrate into Nix, so I need a persistent download link to the exact arm64 build.

@robertsLando
Copy link
Member

@CMCDragonkai I still don't undestand what you mean...

If you install https://github.com/yao-pkg/pkg npm install -d @yao-pkg/pkg the new binary is automatically downloaded (like it happens for all the others) once you specify Macos ARM64 as a target. You can find the asset in this release: https://github.com/yao-pkg/pkg-fetch/releases/tag/v3.5

In order to understand how pkg-fetch releases work I suggest you to give a look at https://github.com/yao-pkg/pkg-fetch/blob/main/DEVELOPMENT.md.

Essentially new releases of this package will not create a new GH release, only minor releases will have a related GH release and that should happen only when something changes on patches (like new method added or else that requires ALL patches to be built again as them will not be compatible with the old ones... also the pkg-fetch version is used in the path to the binaries cache, so bumping a minor would change also that for no reason.

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.

Regarding macos-arm64
3 participants