This is an automated email from the ASF dual-hosted git repository.

baodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
     new 13c2859  feat: Use macos-arm64 github runnner to build napi package 
(#386)
13c2859 is described below

commit 13c285989743aa37e5c2b2909fadef0d343b228e
Author: Baodi Shi <ba...@apache.org>
AuthorDate: Wed May 22 17:38:40 2024 +0800

    feat: Use macos-arm64 github runnner to build napi package (#386)
---
 .github/workflows/ci-build-release-napi.yml | 26 ++++++++++----------------
 .github/workflows/ci-pr-validation.yml      | 19 ++++++++++---------
 2 files changed, 20 insertions(+), 25 deletions(-)

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 @@ concurrency:
 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 @@ jobs:
           - 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 @@ jobs:
         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
+      - name: Build Node binaries lib
         run: |
           if [ "${{ matrix.arch }}" = "x64" ]; then
-            echo "ARCH=x86_64" >> $GITHUB_ENV
+            export ARCH=x86_64
           else
-            echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
+            export ARCH=${{ matrix.arch }}
           fi
-
-      - name: Build Node binaries lib
-        run: |
-          export ARCH=${{ env.ARCH }}
           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 @@ jobs:
 
   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 @@ jobs:
           - 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 @@ jobs:
         with:
           python-version: ${{ matrix.python }}
 
-      - name: Add arch env vars
+      - name: Build Node binaries lib
         run: |
           if [ "${{ matrix.arch }}" = "x64" ]; then
-            echo "ARCH=x86_64" >> $GITHUB_ENV
+            export ARCH=x86_64
           else
-            echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
+            export ARCH=${{ matrix.arch }}
           fi
-
-      - name: Build Node binaries lib
-        run: |
-          export ARCH=${{ env.ARCH }}
           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
 

Reply via email to