ci: fix workflow logic #12
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 # ← 官方 arm64 runner | |
| 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 artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-${{ matrix.arch }}-build | |
| path: | | |
| ./build/ | |
| ./lib/binding/ |