From e0469ee14c9a8eaf126b6ba74f210e1535584ea5 Mon Sep 17 00:00:00 2001 From: yeliex Date: Thu, 14 Dec 2023 16:45:20 +0800 Subject: [PATCH] chore: support multi-arch and more node version --- .github/workflows/release.yml | 20 +++++++++++++------- .github/workflows/test.yml | 16 +++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f10f5a..9aa1ee4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,28 +7,34 @@ on: jobs: build: - name: Build binary for ${{ matrix.os }} and Node.js ${{ matrix.node-version }} + name: ${{ matrix.os }}/${{ matrix.arch }} Node ${{ matrix.node }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [16, 18, 20] - runs-on: ${{ matrix.os }} + os: [ ubuntu-latest, macos-latest, windows-latest ] + node: [ 16, 18, 20 ] + arch: [ amd64, arm64 ] steps: - name: Checkout uses: actions/checkout@v3 + # See https://github.com/nodejs/node-gyp/issues/2869 + - name: Fix node-gyp and Python + run: python3 -m pip install packaging setuptools + - name: Install pnpm uses: pnpm/action-setup@v2 with: run_install: | args: [--ignore-scripts] - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: ${{ matrix.node }} + architecture: ${{ matrix.arch }} cache: "pnpm" - name: Build binary @@ -39,5 +45,5 @@ jobs: - name: Release env: - NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }} + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm binary:release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b3fa9f..689c913 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,28 +10,34 @@ on: jobs: test: - name: Test on ${{ matrix.os }} and Node.js ${{ matrix.node-version }} - runs-on: ubuntu-latest + name: ${{ matrix.os }}/${{ matrix.arch }} Node ${{ matrix.node }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [16, 18, 20] + node: [16, 18, 20] + arch: [amd64, arm64] steps: - name: Checkout uses: actions/checkout@v3 + # See https://github.com/nodejs/node-gyp/issues/2869 + - name: Fix node-gyp and Python + run: python3 -m pip install packaging setuptools + - name: Install pnpm uses: pnpm/action-setup@v2 with: run_install: | args: [--ignore-scripts] - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: ${{ matrix.node }} + architecture: ${{ matrix.arch }} cache: "pnpm" - name: Build binary