feat: Use macos-arm64 github runnner to build napi package (#386)
(cherry picked from commit 13c285989743aa37e5c2b2909fadef0d343b228e)
diff --git a/.github/workflows/ci-build-release-napi.yml b/.github/workflows/ci-build-release-napi.yml
index 8278a50..fe779f7 100644
--- a/.github/workflows/ci-build-release-napi.yml
+++ b/.github/workflows/ci-build-release-napi.yml
@@ -30,7 +30,7 @@
jobs:
macos-napi:
name: Build NAPI macos - Node ${{matrix.nodejs}} - ${{matrix.arch}}
- runs-on: macos-latest
+ runs-on: ${{ matrix.os }}
timeout-minutes: 3000
strategy:
@@ -43,6 +43,12 @@
- 18
python:
- "3.10"
+ include:
+ - arch: x64
+ os: macos-13
+ - arch: arm64
+ # macos-14 is used for arm64
+ os: macos-14
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.nodejs }}
@@ -56,31 +62,19 @@
with:
python-version: ${{ matrix.python }}
- - name: Cache Dependencies
- id: cache-dependencies
- uses: actions/cache@v3
- with:
- path: pkg/mac/build
- key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }}
-
- - name: Add arch env vars
- run: |
- if [ "${{ matrix.arch }}" = "x64" ]; then
- echo "ARCH=x86_64" >> $GITHUB_ENV
- else
- echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
- fi
-
- name: Build Node binaries lib
run: |
- export ARCH=${{ env.ARCH }}
+ if [ "${{ matrix.arch }}" = "x64" ]; then
+ export ARCH=x86_64
+ else
+ export ARCH=${{ matrix.arch }}
+ fi
pkg/mac/download-cpp-client.sh
npm install --ignore-scripts
npx node-pre-gyp configure --target_arch=${{ matrix.arch }}
npx node-pre-gyp build --target_arch=${{ matrix.arch }}
- name: Test loading Node binaries lib
- if: matrix.arch == 'x64'
run: |
node pkg/load_test.js
diff --git a/.github/workflows/ci-pr-validation.yml b/.github/workflows/ci-pr-validation.yml
index 65487c0..70066b1 100644
--- a/.github/workflows/ci-pr-validation.yml
+++ b/.github/workflows/ci-pr-validation.yml
@@ -72,7 +72,7 @@
macos-napi:
name: Build NAPI macos - Node ${{matrix.nodejs}} - ${{matrix.arch}}
- runs-on: macos-latest
+ runs-on: ${{ matrix.os }}
timeout-minutes: 3000
strategy:
@@ -85,6 +85,12 @@
- 18
python:
- "3.10"
+ include:
+ - arch: x64
+ os: macos-13
+ - arch: arm64
+ # macos-14 is used for arm64
+ os: macos-14
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.nodejs }}
@@ -98,24 +104,19 @@
with:
python-version: ${{ matrix.python }}
- - name: Add arch env vars
- run: |
- if [ "${{ matrix.arch }}" = "x64" ]; then
- echo "ARCH=x86_64" >> $GITHUB_ENV
- else
- echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
- fi
-
- name: Build Node binaries lib
run: |
- export ARCH=${{ env.ARCH }}
+ if [ "${{ matrix.arch }}" = "x64" ]; then
+ export ARCH=x86_64
+ else
+ export ARCH=${{ matrix.arch }}
+ fi
pkg/mac/download-cpp-client.sh
npm install --ignore-scripts
npx node-pre-gyp configure --target_arch=${{ matrix.arch }}
npx node-pre-gyp build --target_arch=${{ matrix.arch }}
- name: Test loading Node binaries lib
- if: matrix.arch == 'x64'
run: |
node pkg/load_test.js