diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 145da17..660acf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: jobs: test: - name: Test on ${{ matrix.os }} with Node.js ${{ matrix.node-version }} + name: Test on ${{ matrix.os }} ${{ matrix.arch }} with Node.js ${{ matrix.node-version }} runs-on: ${{ matrix.os }} strategy: @@ -19,15 +19,24 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel] node-version: [20.x, 22.x, 24.x] + arch: [x64] + include: + - os: windows-latest + node-version: 20.x + arch: x86 + - os: windows-latest + node-version: 22.x + arch: x86 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} + architecture: ${{ matrix.arch }} cache: 'npm' - name: Install dependencies @@ -40,5 +49,4 @@ jobs: run: npm run test - name: Prebuild - shell: bash run: npm run prebuild diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c918b5..140a371 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,23 +7,33 @@ on: jobs: prebuild: - name: Test on ${{ matrix.os }} with Node.js ${{ matrix.node-version }} + name: Prebuild on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel] - node-version: [20.x, 22.x, 24.x] + include: + - os: ubuntu-latest + arch: x64 + - os: windows-latest + arch: x64 + - os: windows-latest + arch: x86 + - os: macos-latest + arch: x64 + - os: macos-15-intel + arch: x64 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - name: Setup Node.js + uses: actions/setup-node@v6 with: - node-version: ${{ matrix.node-version }} + node-version: '22.x' + architecture: ${{ matrix.arch }} cache: 'npm' - name: Install dependencies @@ -36,13 +46,12 @@ jobs: run: npm run test - name: Prebuild - shell: bash run: npm run prebuild - name: Upload prebuilds - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: ref-napi-prebuild-${{ matrix.os }}-${{ matrix.node-version }} + name: ref-napi-prebuild-${{ matrix.os }}-${{ matrix.arch }} path: prebuilds/ publish: @@ -55,10 +64,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: '22.x' registry-url: 'https://registry.npmjs.org' @@ -71,9 +80,10 @@ jobs: run: npm test - name: Download all prebuilds - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v8 with: path: prebuilds + merge-multiple: true - run: ls -R prebuilds/ - name: Publish to npm diff --git a/package.json b/package.json index 11c38f0..e9d6576 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test": "nyc mocha --expose-gc", "build": "node-gyp rebuild", "install": "node-gyp-build", - "prebuild": "prebuildify --napi --tag-armv --tag-uv --strip", + "prebuild": "node scripts/prebuild.js", "prepack": "([ $(ls prebuilds | wc -l) > '0' ] || (echo 'Some prebuilds are missing'; exit 1))" }, "dependencies": { diff --git a/scripts/prebuild.js b/scripts/prebuild.js new file mode 100644 index 0000000..19456ad --- /dev/null +++ b/scripts/prebuild.js @@ -0,0 +1,10 @@ +const { execFileSync } = require('child_process') + +execFileSync(process.execPath, [ + require.resolve('prebuildify/bin.js'), + '--napi', + '--tag-armv', + '--tag-uv', + '--strip', + '--target', process.versions.node +], { stdio: 'inherit' })