Update package.json #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Build | |
| on: | |
| push: | |
| branches: [ feature/custom ] | |
| pull_request: | |
| branches: [ feature/custom ] | |
| jobs: | |
| macos-build: | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x64 | |
| runs-on: macos-14 | |
| lipo_arch: x86_64 | |
| - arch: arm64 | |
| runs-on: macos-14-xlarge | |
| lipo_arch: arm64 | |
| runs-on: ${{ matrix.runs-on }} | |
| name: macOS ${{ matrix.arch }} Build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.18.0 | |
| architecture: ${{ matrix.arch }} | |
| - name: Prepare OpenSSL for ${{ matrix.arch }} | |
| run: | | |
| lipo -thin ${{ matrix.lipo_arch }} deps/openssl-macos/libcrypto.a -output deps/openssl-macos/libcrypto-thin.a | |
| mv deps/openssl-macos/libcrypto-thin.a deps/openssl-macos/libcrypto.a | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build | |
| env: | |
| GYP_ARGS: ${{ matrix.arch == 'arm64' && '--target_arch=arm64' || '' }} | |
| run: ./node_modules/.bin/node-pre-gyp rebuild | |
| - name: Run tests | |
| run: npm test | |
| - name: Upload architecture-specific artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-${{ matrix.arch }}-build | |
| path: | | |
| ./build/Release/node_sqlite3.node | |
| # ---------- 新增:Universal Binary ---------- | |
| macos-universal: | |
| needs: [macos-build] | |
| runs-on: macos-14 | |
| name: macOS Universal Binary | |
| steps: | |
| - name: Download x64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-x64-build | |
| path: ./x64 | |
| - name: Download arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-arm64-build | |
| path: ./arm64 | |
| - name: Create universal binary | |
| run: | | |
| lipo -create \ | |
| ./x64/node_sqlite3.node \ | |
| ./arm64/node_sqlite3.node \ | |
| -output ./node_sqlite3-universal.node | |
| - name: Upload universal artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-universal | |
| path: ./node_sqlite3-universal.node |