From 0ec7a5425809f139aa502d8a1cf391b33c88d6fc Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 4 Aug 2025 13:57:39 -0700 Subject: [PATCH] chore: build profiling and production versions --- .github/workflows/publish.yaml | 54 ++++++++++++++++++++++++++++++---- deps/sqlcipher/sqlcipher.gyp | 2 +- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c07bf26..cd4e6f5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -20,6 +20,7 @@ jobs: strategy: matrix: os: [windows-latest, macos-latest] + buildType: ['production', 'profiling'] include: - os: macos-latest target: arm64 @@ -51,6 +52,10 @@ jobs: with: node-version-file: '.nvmrc' + - name: Update package.json + if: ${{ matrix.buildType == 'profiling' }} + run: pnpm version prerelease --no-git-tag-version --preid profiling + - name: Install node_modules run: pnpm install --frozen-lockfile @@ -68,27 +73,55 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: - name: sqlcipher-${{matrix.os}} + name: sqlcipher-${{matrix.buildType}}-${{matrix.os}} path: prebuilds/* prebuild_linux: runs-on: ubuntu-latest timeout-minutes: 30 + strategy: + matrix: + buildType: ['production', 'profiling'] + steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10.3.0 + + - name: Get Node version from .nvmrc + id: get-nvm-version + shell: bash + run: echo "node-version=$(cat .nvmrc)" >> $GITHUB_OUTPUT + + - name: Setup node.js + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version-file: '.nvmrc' + + - name: Update package.json + if: ${{ matrix.buildType == 'profiling' }} + run: pnpm version prerelease --no-git-tag-version --preid profiling + - name: Build in docker container run: ./docker-prebuildify.sh - name: Upload artifacts uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: - name: sqlcipher-linux-latest + name: sqlcipher-${{matrix.buildType}}-linux-latest path: prebuilds/* publish: name: Publish + strategy: + matrix: + buildType: ['production', 'profiling'] + permissions: # Needed for ncipollo/release-action. contents: 'write' @@ -116,10 +149,14 @@ jobs: - name: Download built libraries uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.19.1 with: - pattern: sqlcipher-* + pattern: sqlcipher-${{matrix.buildType}}-* path: prebuilds merge-multiple: true + - name: Update package.json + if: ${{ matrix.buildType == 'profiling' }} + run: pnpm version prerelease --no-git-tag-version --preid profiling + - name: Install node_modules run: pnpm install --frozen-lockfile @@ -133,11 +170,18 @@ jobs: env: PREBUILDS_ONLY: 1 - - name: Publish + - name: Publish production + if: ${{ matrix.buildType == 'production' }} run: pnpm publish --tag '${{ github.event.inputs.npm_tag }}' --access public --no-git-checks ${{ inputs.dry_run && '--dry-run' || ''}} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish profiling + if: ${{ matrix.buildType == 'profiling' }} + run: pnpm publish --tag 'profiling' --access public --no-git-checks ${{ inputs.dry_run && '--dry-run' || ''}} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Rename symbols run: | mv prebuilds/darwin-arm64/node_sqlcipher.sym prebuilds/node_sqlcipher_darwin_arm64.sym @@ -150,7 +194,7 @@ jobs: # This step is expected to fail if not run on a tag. - name: Upload debug info to release uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 - if: ${{ !inputs.dry_run }} + if: ${{ !inputs.dry_run && matrix.buildType == 'production' }} with: allowUpdates: true artifactErrorsFailBuild: true diff --git a/deps/sqlcipher/sqlcipher.gyp b/deps/sqlcipher/sqlcipher.gyp index 9c0e32b..15757b0 100755 --- a/deps/sqlcipher/sqlcipher.gyp +++ b/deps/sqlcipher/sqlcipher.gyp @@ -99,7 +99,7 @@ }], # Profiling - ["\"