diff --git a/.agents/skills/e2e/SKILL.md b/.agents/skills/e2e/SKILL.md index bc9f3efe42f4..aa7dcde7ad5a 100644 --- a/.agents/skills/e2e/SKILL.md +++ b/.agents/skills/e2e/SKILL.md @@ -118,6 +118,7 @@ All tests completed successfully. Your SDK changes work correctly with this test - **Test app not found**: List available apps and ask user to clarify - **Packed tarballs missing**: Run `yarn build:tarball` at the repo root, then `yarn test:prepare` in `dev-packages/e2e-tests` - **Build failures**: Fix build errors before running tests +- **pnpm errors such as `packages field missing or empty`**: The app needs the pnpm version in its `volta.pnpm`. Run with Volta, which installs that version ## Common Test Applications diff --git a/.github/actions/install-pnpm/action.yml b/.github/actions/install-pnpm/action.yml new file mode 100644 index 000000000000..d2d28a09dbb4 --- /dev/null +++ b/.github/actions/install-pnpm/action.yml @@ -0,0 +1,30 @@ +name: 'Install pnpm' +description: 'Installs the pnpm version that Volta pins for a package.' +inputs: + package-json: + description: 'The package.json to read `volta.pnpm` from. `volta.extends` is followed until a version is found.' + default: 'package.json' + +runs: + using: 'composite' + steps: + - name: Resolve pnpm version + id: pnpm-version + shell: bash + env: + PACKAGE_JSON: ${{ inputs.package-json }} + # Keep in sync with `getPnpmMajor` in `dev-packages/e2e-tests/lib/pnpmOverrides.ts`. It writes the overrides in + # the format of the version it finds, so a different lookup breaks the install. + run: | + package_json="$PACKAGE_JSON" + until version=$(jq -er '.volta.pnpm' "$package_json"); do + extends=$(jq -er '.volta.extends' "$package_json") || { + echo "::error::No volta.pnpm in $PACKAGE_JSON or the files it extends" + exit 1 + } + package_json="$(dirname "$package_json")/$extends" + done + echo "version=$version" >> "$GITHUB_OUTPUT" + - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + with: + version: ${{ steps.pnpm-version.outputs.version }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bfe174349582..55dcd184d04c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -892,9 +892,8 @@ jobs: with: ref: ${{ env.HEAD_COMMIT }} # The fixtures install the locally-packed `@sentry/bundler-plugins` tarball with pnpm. - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - with: - version: 9.15.9 + - name: Install pnpm + uses: ./.github/actions/install-pnpm - name: Set up Node uses: actions/setup-node@v7 with: @@ -1056,9 +1055,10 @@ jobs: uses: actions/checkout@v7 with: ref: ${{ env.HEAD_COMMIT }} - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + - name: Install pnpm + uses: ./.github/actions/install-pnpm with: - version: ${{ matrix.test-application == 'nuxt-5' && '11.10.0' || '9.15.9' }} + package-json: 'dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/package.json' - name: Set up Node uses: actions/setup-node@v7 with: @@ -1211,9 +1211,10 @@ jobs: uses: actions/checkout@v7 with: ref: ${{ env.HEAD_COMMIT }} - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + - name: Install pnpm + uses: ./.github/actions/install-pnpm with: - version: ${{ matrix.test-application == 'nuxt-5' && '11.10.0' || '9.15.9' }} + package-json: 'dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/package.json' - name: Set up Node uses: actions/setup-node@v7 with: diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index fd9c8d6ce524..f3ddfbf71bd8 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -117,9 +117,10 @@ jobs: uses: actions/checkout@v7 with: ref: ${{ env.HEAD_COMMIT }} - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + - name: Install pnpm + uses: ./.github/actions/install-pnpm with: - version: 9.15.9 + package-json: 'dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/package.json' - name: Set up Node uses: actions/setup-node@v7 with: diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 6928d5d4073e..e67fa7c7cd66 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -19,9 +19,8 @@ jobs: VITE_E2E_TEST_DSN: 'https://username@domain/123' steps: - uses: actions/checkout@v7 - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - with: - version: 9.15.9 + - name: Install pnpm + uses: ./.github/actions/install-pnpm - uses: actions/setup-node@v7 with: node-version-file: 'package.json' diff --git a/dev-packages/e2e-tests/README.md b/dev-packages/e2e-tests/README.md index 824784c63492..1c1da7180faf 100644 --- a/dev-packages/e2e-tests/README.md +++ b/dev-packages/e2e-tests/README.md @@ -118,6 +118,9 @@ Make sure to add a `test:build` and `test:assert` command to the new app's `pack Sentry packages are automatically resolved to the local build via pnpm overrides injected at test time, so no manual registry configuration is needed. +Apps use the root pnpm version. To use another one, set `volta.pnpm` in the app's `package.json`. Volta (locally) and +CI (`.github/actions/install-pnpm`) both install that version. + ### Test apps that deploy a real Cloudflare Worker Apps like `cloudflare-workers-send-to-sentry` deploy the built app as a real Worker and check what arrives in Sentry: diff --git a/dev-packages/e2e-tests/lib/pnpmOverrides.ts b/dev-packages/e2e-tests/lib/pnpmOverrides.ts index 51fa793f5eae..e9f79d05f71e 100644 --- a/dev-packages/e2e-tests/lib/pnpmOverrides.ts +++ b/dev-packages/e2e-tests/lib/pnpmOverrides.ts @@ -57,6 +57,7 @@ export async function addPnpmOverrides(tmpDirPath: string, packedDirPath: string console.log(`Added ${packageNames.length} internal Sentry package overrides`); } +// Keep in sync with `.github/actions/install-pnpm`, which installs the version this finds in CI. async function getPnpmMajor( packageJsonPath: string, packageJson: { volta?: { extends?: string; pnpm?: string } },