From f1d286601f2bda90732c542f4a94925e52fc134d Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Wed, 22 May 2024 17:38:40 +0800 Subject: [PATCH] feat: Use macos-arm64 github runnner to build napi package (#386) (cherry picked from commit 13c285989743aa37e5c2b2909fadef0d343b228e) --- .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 8278a500..fe779f75 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 65487c05..70066b1b 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