diff --git a/.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml b/.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml index 9a2fe5fbff59..cd406d995804 100644 --- a/.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml +++ b/.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml @@ -149,28 +149,22 @@ runs: echo "::endgroup::" shell: bash + # pnpm/setup downloads pnpm's own standalone binary — no Node and no npm + # involved — and with `cache: true` restores and saves the pnpm store itself, + # keyed on core-web/pnpm-lock.yaml, replacing the `pnpm store path` probe and + # the paired restore/save cache steps this action used to carry. + # + # No `version` input: it comes from core-web/package.json + # (devEngines.packageManager, falling back to packageManager). + # + # install: false because the install is run explicitly in the next step, which + # also records the resolved pnpm and Node versions in the job log. - name: Set up pnpm - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 with: - package_json_file: core-web/package.json - run_install: false - - - name: Get pnpm store directory path - id: pnpm-info - shell: bash - run: | - echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT - echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT - - - id: restore-cache-pnpm - name: Restore pnpm Store Cache - uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ steps.pnpm-info.outputs.dir }} - key: ${{ runner.os }}-pnpm-${{ steps.pnpm-info.outputs.version }}-${{ hashFiles('core-web/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-${{ steps.pnpm-info.outputs.version }} - ${{ runner.os }}-pnpm- + working-directory: core-web + install: false + cache: true - name: 'Install project' working-directory: ${{ github.workspace }}/core-web/ @@ -181,14 +175,6 @@ runs: node --version shell: bash - - id: save-cache-pnpm - name: Save pnpm Store Cache - if: ${{ steps.restore-cache-pnpm.outputs.cache-hit != 'true' }} - uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ steps.pnpm-info.outputs.dir }} - key: ${{ steps.restore-cache-pnpm.outputs.cache-primary-key }} - - name: 'Build SDK packages' working-directory: ${{ github.workspace }}/core-web/ run: | diff --git a/.github/actions/core-cicd/maven-job/action.yml b/.github/actions/core-cicd/maven-job/action.yml index c2e51a824fbe..335d92efb4e3 100644 --- a/.github/actions/core-cicd/maven-job/action.yml +++ b/.github/actions/core-cicd/maven-job/action.yml @@ -205,50 +205,70 @@ runs: uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: installs - # hash nodejs-parent/pom.xml so the pnpm-era layout (install-node-and-npm - # + corepack shim) is not mixed with the yarn-era layout from cached - # builds of the previous toolchain. + # hash nodejs-parent/pom.xml because that pom is what decides the contents + # of installs/: it holds and installs pnpm into the same + # prefix as Node, so bumping the pinned pnpm (or Node) invalidates this key + # instead of restoring a cache built for the previous versions. key: node-binary-${{ hashFiles('core-web/.nvmrc', 'nodejs-parent/pom.xml') }} - - name: Verify pnpm version is in sync between package.json and nodejs-parent/pom.xml + - name: Verify the pinned toolchain versions are in sync if: ${{ inputs.requires-node == 'true' }} shell: bash run: | set -euo pipefail - pkg_json_pm=$(jq -r '.packageManager' core-web/package.json) - pkg_json_version="${pkg_json_pm#pnpm@}" - pom_version=$(grep -oE '[^<]+' nodejs-parent/pom.xml | sed -E 's|||g') - if [ "$pkg_json_version" != "$pom_version" ]; then - echo "::error::pnpm version mismatch: core-web/package.json=$pkg_json_version vs nodejs-parent/pom.xml=$pom_version. Keep these in sync — Maven uses the pom value while the pnpm store cache key uses the package.json value." >&2 - exit 1 - fi - echo "pnpm version in sync: $pom_version" - + # nodejs-parent/pom.xml is the reference: Maven installs those versions and every + # module runs them. Every other declaration has to agree, including the ones that + # only the workflow reads — pnpm/setup resolves its version from + # devEngines.packageManager *before* falling back to packageManager, so checking + # packageManager alone would let a devEngines-only bump install a different pnpm + # than Maven's, with nothing failing. Same for devEngines.runtime and Node. + # Collect every mismatch before failing, so a contributor who forgot to bump one + # declaration does not fix it, re-run CI, and only then learn about the next. + pom_pnpm=$(grep -oE '[^<]+' nodejs-parent/pom.xml | sed -E 's|||g') + pom_node=$(grep -oE '[^<]+' nodejs-parent/pom.xml | sed -E 's|||g') + pom_node=${pom_node#v} + fail=0 + + # An absent declaration is fine; a present one must match. Written as a plain `if` + # rather than a `&&` chain because under `set -e` a short-circuited chain returns + # non-zero and would abort the step instead of recording the mismatch. + check() { #