From 3a6717cc19852c7feb102d1e7026f181d7a50269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85berg?= Date: Tue, 16 Dec 2025 00:23:58 +0100 Subject: [PATCH] Use pnpm in all/most workflows --- .github/workflows/build-cli.yml | 32 +++-- .github/workflows/build-desktop.yml | 135 +++++++++++------- .github/workflows/chromatic.yml | 20 +-- .github/workflows/locales-lint.yml | 10 +- .github/workflows/nx.yml | 13 +- .github/workflows/repository-management.yml | 20 +-- .../workflows/sdk-breaking-change-check.yml | 31 ++-- .github/workflows/test.yml | 17 ++- 8 files changed, 172 insertions(+), 106 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 964cbc834c5..ed4e3d7cfc2 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -129,15 +129,20 @@ jobs: echo "SHORT_RUNNER_OS=$SHORT_RUNNER_OS" } >> "$GITHUB_ENV" + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Install - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Remove commercial packages @@ -163,12 +168,12 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Build & Package Unix env: _SHORT_RUNNER_OS: ${{ env.SHORT_RUNNER_OS }} - run: npm run "dist:${{ matrix.license_type.build_prefix }}:$_SHORT_RUNNER_OS${{ matrix.os.target_suffix }}" --quiet + run: pnpm run "dist:${{ matrix.license_type.build_prefix }}:$_SHORT_RUNNER_OS${{ matrix.os.target_suffix }}" --quiet - name: Login to Azure if: ${{ matrix.os.base == 'mac' && needs.setup.outputs.has_secrets == 'true' }} @@ -284,7 +289,7 @@ jobs: working-directory: ./ - name: Install (CLI) - run: npm i + run: pnpm install - name: Output help run: node ./build/bw.js --help @@ -325,11 +330,16 @@ jobs: choco install reshack --no-progress choco install nasm --no-progress + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Get pkg-fetch @@ -412,7 +422,7 @@ jobs: uses: bitwarden/gh-actions/azure-logout@main - name: Install - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Remove commercial packages @@ -438,10 +448,10 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Build & Package Windows - run: npm run dist:${{ matrix.license_type.build_prefix }}:win --quiet + run: pnpm run dist:${{ matrix.license_type.build_prefix }}:win --quiet - name: Sign executable if: ${{ needs.setup.outputs.has_secrets == 'true' }} diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index efb94e44c7a..d799d4ce1c7 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -192,11 +192,16 @@ jobs: sudo rm -rf /usr/local/aws-cli sudo rm -rf /usr/local/aws-sam-cli + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Cache Rust dependencies @@ -217,12 +222,12 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version snap --version snapcraft --version || echo 'snapcraft unavailable' - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -243,7 +248,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -268,7 +273,7 @@ jobs: node build.js --release - name: Build application - run: npm run dist:lin + run: pnpm run dist:lin - name: Upload tar.gz artifact uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 @@ -316,7 +321,7 @@ jobs: working-directory: apps/desktop run: | sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - sudo npm run pack:lin:flatpak + sudo pnpm run pack:lin:flatpak - name: Upload flatpak artifact uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 @@ -348,11 +353,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Cache Rust dependencies @@ -380,12 +390,12 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version snap --version snapcraft --version - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -406,7 +416,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -444,7 +454,7 @@ jobs: # Snapcraft environment variables to bypass LXD requirement on ARM64 SNAPCRAFT_BUILD_ENVIRONMENT: host USE_SYSTEM_FPM: true - run: npm run dist:lin:arm64 + run: pnpm run dist:lin:arm64 - name: Upload .snap artifact uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 @@ -464,7 +474,7 @@ jobs: working-directory: apps/desktop run: | sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - sudo npm run pack:lin:flatpak + sudo pnpm run pack:lin:flatpak - name: Upload flatpak artifact uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 @@ -496,11 +506,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Cache Rust dependencies @@ -519,7 +534,7 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version choco --version rustup show @@ -548,7 +563,7 @@ jobs: uses: bitwarden/gh-actions/azure-logout@main - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -569,7 +584,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -588,12 +603,12 @@ jobs: run: node build.js cross-platform "$env:MODE" - name: Build - run: npm run build + run: pnpm run build - name: Pack if: ${{ needs.setup.outputs.has_secrets == 'false' }} run: | - npm run pack:win + pnpm run pack:win - name: Pack & Sign if: ${{ needs.setup.outputs.has_secrets == 'true' }} @@ -605,7 +620,7 @@ jobs: SIGNING_CLIENT_SECRET: ${{ steps.retrieve-secrets.outputs.code-signing-client-secret }} SIGNING_CERT_NAME: ${{ steps.retrieve-secrets.outputs.code-signing-cert-name }} run: | - npm run pack:win + pnpm run pack:win - name: Rename appx files for store if: ${{ needs.setup.outputs.has_secrets == 'true' }} @@ -764,11 +779,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Cache Rust dependencies @@ -784,7 +804,7 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version choco --version rustup show @@ -813,7 +833,7 @@ jobs: uses: bitwarden/gh-actions/azure-logout@main - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -834,7 +854,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -853,11 +873,11 @@ jobs: run: node build.js cross-platform "$env:MODE" - name: Build - run: npm run build + run: pnpm run build - name: Pack if: ${{ needs.setup.outputs.has_secrets == 'false' }} - run: npm run pack:win:beta + run: pnpm run pack:win:beta - name: Pack & Sign if: ${{ needs.setup.outputs.has_secrets == 'true' }} @@ -868,7 +888,7 @@ jobs: SIGNING_TENANT_ID: ${{ steps.retrieve-secrets.outputs.code-signing-tenant-id }} SIGNING_CLIENT_SECRET: ${{ steps.retrieve-secrets.outputs.code-signing-client-secret }} SIGNING_CERT_NAME: ${{ steps.retrieve-secrets.outputs.code-signing-cert-name }} - run: npm run pack:win:beta + run: pnpm run pack:win:beta - name: Rename appx files for store if: ${{ needs.setup.outputs.has_secrets == 'true' }} @@ -1009,11 +1029,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Set up Python @@ -1034,7 +1059,7 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version rustup show echo "GitHub ref: $GITHUB_REF" echo "GitHub event: $GITHUB_EVENT" @@ -1171,7 +1196,7 @@ jobs: "### MacOS build number: $env:BUILD_NUMBER" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -1192,7 +1217,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -1211,7 +1236,7 @@ jobs: run: node build.js cross-platform "$MODE" - name: Build application (dev) - run: npm run build + run: pnpm run build browser-build: name: Browser Build @@ -1249,11 +1274,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Set up Python @@ -1274,7 +1304,7 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version rustup show echo "GitHub ref: $GITHUB_REF" echo "GitHub event: $GITHUB_EVENT" @@ -1395,7 +1425,7 @@ jobs: Write-Output "### MacOS GitHub build number: $env:BUILD_NUMBER" - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -1416,7 +1446,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -1436,7 +1466,7 @@ jobs: - name: Build if: steps.build-cache.outputs.cache-hit != 'true' - run: npm run build + run: pnpm run build - name: Download Browser artifact uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 @@ -1469,7 +1499,7 @@ jobs: APP_STORE_CONNECT_AUTH_KEY: 6TV9MKN3GP APP_STORE_CONNECT_AUTH_KEY_PATH: ~/private_keys/AuthKey_6TV9MKN3GP.p8 CSC_FOR_PULL_REQUEST: true - run: npm run pack:mac + run: pnpm run pack:mac - name: Upload .zip artifact uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 @@ -1524,11 +1554,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - name: Set up Python @@ -1549,7 +1584,7 @@ jobs: - name: Print environment run: | node --version - npm --version + pnpm --version rustup show echo "GitHub ref: $GITHUB_REF" echo "GitHub event: $GITHUB_EVENT" @@ -1678,7 +1713,7 @@ jobs: Write-Output "### MacOS App Store build number: $env:BUILD_NUMBER" - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile working-directory: ./ - name: Download SDK Artifacts @@ -1699,7 +1734,7 @@ jobs: working-directory: ./ run: | ls -l ../ - npm link ../sdk-internal + pnpm link ../sdk-internal - name: Cache Native Module uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 @@ -1719,7 +1754,7 @@ jobs: - name: Build if: steps.build-cache.outputs.cache-hit != 'true' - run: npm run build + run: pnpm run build - name: Download Browser artifact uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 @@ -1752,7 +1787,7 @@ jobs: APP_STORE_CONNECT_AUTH_KEY: 6TV9MKN3GP APP_STORE_CONNECT_AUTH_KEY_PATH: ~/private_keys/AuthKey_6TV9MKN3GP.p8 CSC_FOR_PULL_REQUEST: true - run: npm run pack:mac:mas + run: pnpm run pack:mac:mas - name: Create MacOS App Store build number artifact shell: pwsh diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 677d3dfc1df..8017b047ac1 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -57,28 +57,28 @@ jobs: NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ steps.retrieve-node-version.outputs.node_version }} if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' - - name: Cache NPM - id: npm-cache - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 - with: - path: "~/.npm" - key: ${{ runner.os }}-npm-chromatic-${{ hashFiles('**/package-lock.json') }} - if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' - - name: Install Node dependencies if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' - run: npm ci + run: pnpm install --frozen-lockfile # Manually build the Storybook to resolve a bug related to TurboSnap - name: Build Storybook if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true' - run: npm run build-storybook:ci + run: pnpm run build-storybook:ci - name: Log in to Azure uses: bitwarden/gh-actions/azure-login@main diff --git a/.github/workflows/locales-lint.yml b/.github/workflows/locales-lint.yml index 8335d6aacad..d16419606f0 100644 --- a/.github/workflows/locales-lint.yml +++ b/.github/workflows/locales-lint.yml @@ -26,11 +26,17 @@ jobs: ref: ${{ github.event.pull_request.base.sha }} path: base persist-credentials: false + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Install dependencies - run: npm ci + run: pnpm install --frozen-lockfile + - name: Compare run: | - if npm run test:locales; then + if pnpm run test:locales; then echo "Lint check successful." else echo "Lint check failed." diff --git a/.github/workflows/nx.yml b/.github/workflows/nx.yml index 0f01aa27899..cfa63204cf0 100644 --- a/.github/workflows/nx.yml +++ b/.github/workflows/nx.yml @@ -25,15 +25,20 @@ jobs: NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ env._NODE_VERSION }} - + - name: Install dependencies - run: npm ci + run: pnpm install --frozen-lockfile - name: Set Nx SHAs for affected detection uses: nrwl/nx-set-shas@826660b82addbef3abff5fa871492ebad618c9e1 # v4.3.3 diff --git a/.github/workflows/repository-management.yml b/.github/workflows/repository-management.yml index 0a343be878c..5ac0a4a59e1 100644 --- a/.github/workflows/repository-management.yml +++ b/.github/workflows/repository-management.yml @@ -162,14 +162,14 @@ jobs: id: bump-browser-version-override env: VERSION: ${{ inputs.version_number_override }} - run: npm version --workspace=@bitwarden/browser "$VERSION" + run: pnpm version --workspace=@bitwarden/browser "$VERSION" - name: Bump Browser Version - Automatic Calculation if: ${{ inputs.bump_browser == true && inputs.version_number_override == '' }} id: bump-browser-version-automatic env: VERSION: ${{ steps.calculate-next-browser-version.outputs.version }} - run: npm version --workspace=@bitwarden/browser "$VERSION" + run: pnpm version --workspace=@bitwarden/browser "$VERSION" - name: Bump Browser Version - Manifest - Version Override if: ${{ inputs.bump_browser == true && inputs.version_number_override != '' }} @@ -248,14 +248,14 @@ jobs: id: bump-cli-version-override env: VERSION: ${{ inputs.version_number_override }} - run: npm version --workspace=@bitwarden/cli "$VERSION" + run: pnpm version --workspace=@bitwarden/cli "$VERSION" - name: Bump CLI Version - Automatic Calculation if: ${{ inputs.bump_cli == true && inputs.version_number_override == '' }} id: bump-cli-version-automatic env: VERSION: ${{ steps.calculate-next-cli-version.outputs.version }} - run: npm version --workspace=@bitwarden/cli "$VERSION" + run: pnpm version --workspace=@bitwarden/cli "$VERSION" ### Desktop - name: Get current Desktop version @@ -299,27 +299,27 @@ jobs: id: bump-desktop-version-override env: VERSION: ${{ inputs.version_number_override }} - run: npm version --workspace=@bitwarden/desktop "$VERSION" + run: pnpm version --workspace=@bitwarden/desktop "$VERSION" - name: Bump Desktop Version - Root - Automatic Calculation if: ${{ inputs.bump_desktop == true && inputs.version_number_override == '' }} id: bump-desktop-version-automatic env: VERSION: ${{ steps.calculate-next-desktop-version.outputs.version }} - run: npm version --workspace=@bitwarden/desktop "$VERSION" + run: pnpm version --workspace=@bitwarden/desktop "$VERSION" - name: Bump Desktop Version - App - Version Override if: ${{ inputs.bump_desktop == true && inputs.version_number_override != '' }} env: VERSION: ${{ inputs.version_number_override }} - run: npm version "$VERSION" + run: pnpm version "$VERSION" working-directory: "apps/desktop/src" - name: Bump Desktop Version - App - Automatic Calculation if: ${{ inputs.bump_desktop == true && inputs.version_number_override == '' }} env: VERSION: ${{ steps.calculate-next-desktop-version.outputs.version }} - run: npm version "$VERSION" + run: pnpm version "$VERSION" working-directory: "apps/desktop/src" ### Web @@ -364,14 +364,14 @@ jobs: id: bump-web-version-override env: VERSION: ${{ inputs.version_number_override }} - run: npm version --workspace=@bitwarden/web-vault "$VERSION" + run: pnpm version --workspace=@bitwarden/web-vault "$VERSION" - name: Bump Web Version - Automatic Calculation if: ${{ inputs.bump_web == true && inputs.version_number_override == '' }} id: bump-web-version-automatic env: VERSION: ${{ steps.calculate-next-web-version.outputs.version }} - run: npm version --workspace=@bitwarden/web-vault "$VERSION" + run: pnpm version --workspace=@bitwarden/web-vault "$VERSION" ######################## diff --git a/.github/workflows/sdk-breaking-change-check.yml b/.github/workflows/sdk-breaking-change-check.yml index 14547b3942f..1ecd85fe509 100644 --- a/.github/workflows/sdk-breaking-change-check.yml +++ b/.github/workflows/sdk-breaking-change-check.yml @@ -75,11 +75,16 @@ jobs: NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ steps.retrieve-node-version.outputs.node_version }} - name: Install Node dependencies @@ -90,19 +95,19 @@ jobs: MAX_RETRIES=3 while [ ${RETRY_COUNT} -lt ${MAX_RETRIES} ]; do RETRY_COUNT=$((RETRY_COUNT + 1)) - echo "🔄 npm ci attempt ${RETRY_COUNT} of ${MAX_RETRIES}..." + echo "🔄 pnpm install attempt ${RETRY_COUNT} of ${MAX_RETRIES}..." - if npm ci; then - echo "✅ npm ci successful" + if pnpm install --frozen-lockfile; then + echo "✅ pnpm install successful" break else - echo "❌ npm ci attempt ${RETRY_COUNT} failed" + echo "❌ pnpm install attempt ${RETRY_COUNT} failed" [ ${RETRY_COUNT} -lt ${MAX_RETRIES} ] && sleep 5 fi done if [ ${RETRY_COUNT} -eq ${MAX_RETRIES} ]; then - echo "::error::npm ci failed after ${MAX_RETRIES} attempts" + echo "::error::pnpm install failed after ${MAX_RETRIES} attempts" exit 1 fi @@ -118,18 +123,18 @@ jobs: path: ./sdk-internal if_no_artifact_found: fail - - name: Override SDK using npm link + - name: Override SDK using pnpm link working-directory: ./ run: | - echo "🔧 Setting up SDK override using npm link..." + echo "🔧 Setting up SDK override using pnpm link..." echo "📊 SDK Version: ${_SDK_VERSION}" echo "📦 Artifact Source: ${_SOURCE_REPO} run ${_ARTIFACTS_RUN_ID}" echo "📋 SDK package contents:" ls -la ./sdk-internal/ - echo "🔗 Creating npm link to SDK package..." - if ! npm link ./sdk-internal; then + echo "🔗 Creating pnpm link to SDK package..." + if ! pnpm link ./sdk-internal; then echo "::error::Failed to link SDK package" exit 1 fi @@ -138,7 +143,7 @@ jobs: run: | echo "🔍 Running TypeScript type checking with SDK version: ${_SDK_VERSION}" - echo "🎯 Type checking command: npm run test:types" + echo "🎯 Type checking command: pnpm run test:types" # Add GitHub Step Summary output echo "## 📊 TypeScript Compatibility Check" >> $GITHUB_STEP_SUMMARY @@ -150,7 +155,7 @@ jobs: TYPE_CHECK_START=$(date +%s) # Run type check with timeout - exit code determines gh run watch result - if timeout 10m npm run test:types; then + if timeout 10m pnpm run test:types; then TYPE_CHECK_END=$(date +%s) TYPE_CHECK_DURATION=$((TYPE_CHECK_END - TYPE_CHECK_START)) echo "✅ TypeScript compilation successful (${TYPE_CHECK_DURATION}s)" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index faee7220e7b..b8a155e1af5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,31 +35,36 @@ jobs: NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" + - name: Set up pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + version: 10 + - name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - cache: 'npm' - cache-dependency-path: '**/package-lock.json' + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' node-version: ${{ steps.retrieve-node-version.outputs.node_version }} - name: Print environment run: | node --version - npm --version + pnpm --version - name: Install Node dependencies - run: npm ci + run: pnpm install --frozen-lockfile # We use isolatedModules: true which disables typechecking in tests # Tests in apps/ are typechecked when their app is built, so we just do it here for libs/ # See https://bitwarden.atlassian.net/browse/EC-497 - name: Run typechecking - run: npm run test:types + run: pnpm run test:types - name: Run tests # maxWorkers is a workaround for a memory leak that crashes tests in CI: # https://github.com/facebook/jest/issues/9430#issuecomment-1149882002 - run: npm test -- --coverage --maxWorkers=3 + run: pnpm test -- --coverage --maxWorkers=3 - name: Report test results uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3 # v2.1.1