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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
target-node: [14, 16, 18, 19]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- name: Use Node.js 14
uses: actions/setup-node@v1
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18

- run: yarn install --ignore-engines

Expand All @@ -34,8 +34,48 @@ jobs:
run: |
(test -f dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-macos-x64
path: dist/*

macos-arm64:
runs-on: macos-11.0

strategy:
fail-fast: false
matrix:
target-node: [14, 16, 18, 19]

steps:
- uses: actions/checkout@v4

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18

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

env:
CC: clang -arch arm64
CXX: clang++ -arch arm64
CC_host: clang
CXX_host: clang++

- name: Check if binary is compiled
id: check_file
run: |
(test -f dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false

- uses: actions/upload-artifact@v3
if: steps.check_file.outputs.EXISTS == 'true'
with:
name: node${{ matrix.target-node }}-macos-arm64
path: dist/*