Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,9 @@ jobs:
- name: Copy to temp
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
working-directory: dev-packages/e2e-tests
env:
# On develop/master, ignore lockfiles to test with fresh dependencies
Comment thread
JPeer264 marked this conversation as resolved.
E2E_IGNORE_LOCKFILE: ${{ github.event_name != 'pull_request' }}
Comment thread
JPeer264 marked this conversation as resolved.

- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
Expand Down Expand Up @@ -1134,6 +1137,9 @@ jobs:
- name: Copy to temp
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
working-directory: dev-packages/e2e-tests
env:
# On develop/master, ignore lockfiles to test with fresh dependencies
E2E_IGNORE_LOCKFILE: ${{ github.event_name != 'pull_request' }}

- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/release-update-lockfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Release: Update E2E Lockfiles'

on:
release:
types: [published]

jobs:
update-lockfiles:
uses: ./.github/workflows/update-e2e-lockfiles.yml
with:
sentry_only: true
129 changes: 129 additions & 0 deletions .github/workflows/update-e2e-lockfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: 'Update E2E Lockfiles'

on:
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
sentry_only:
description: 'Only update @sentry/* packages'
type: boolean
default: false
workflow_call:
inputs:
sentry_only:
description: 'Only update @sentry/* packages'
type: boolean
default: true

env:
CACHED_DEPENDENCY_PATHS: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/packages/*/node_modules
${{ github.workspace }}/dev-packages/*/node_modules

jobs:
update-lockfiles:
name: Update E2E Lockfiles
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
pull-requests: write
contents: write
steps:
- name: Check out develop branch
uses: actions/checkout@v6
with:
ref: develop

- name: Set up Node
uses: actions/setup-node@v6
with:
node-version-file: 'package.json'

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.9

- name: Install Dependencies
uses: ./.github/actions/install-dependencies

- name: Build packages
run: yarn build

- name: Build tarballs
run: yarn build:tarball

- name: Get node version
id: versions
run: |
echo "node=$(jq -r '.volta.node' package.json)" >> $GITHUB_OUTPUT

- name: Validate Verdaccio
run: yarn test:validate
working-directory: dev-packages/e2e-tests

- name: Prepare Verdaccio
run: yarn test:prepare
working-directory: dev-packages/e2e-tests
env:
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}

- name: Update lockfiles
working-directory: dev-packages/e2e-tests
run: |
for dir in test-applications/*/; do
if [ -f "$dir/package.json" ]; then
echo "Updating: $dir"
if [ "${{ inputs.sentry_only }}" = "true" ]; then
(cd "$dir" && pnpm update "@sentry/*" --ignore-scripts) || echo "Failed: $dir"
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
else
# Update all dependencies (including transitives) to latest within allowed ranges
# --no-save keeps package.json unchanged, only updates the lockfile
(cd "$dir" && pnpm update --no-save --ignore-scripts) || echo "Failed: $dir"
fi
fi
done

- name: Set PR metadata
id: pr-meta
run: |
if [ "${{ inputs.sentry_only }}" = "true" ]; then
echo "title=chore(e2e): Update @sentry/* in lockfiles" >> $GITHUB_OUTPUT
echo "commit=chore(e2e): update @sentry/* in lockfiles" >> $GITHUB_OUTPUT
echo "body=Automated update of @sentry/* packages in E2E test application lockfiles after release." >> $GITHUB_OUTPUT
else
echo "title=chore(e2e): Update pnpm lockfiles" >> $GITHUB_OUTPUT
echo "commit=chore(e2e): update pnpm lockfiles" >> $GITHUB_OUTPUT
echo "body=Automated daily update of E2E test application lockfiles." >> $GITHUB_OUTPUT
fi

- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v7
with:
branch: chore/update-e2e-lockfiles
delete-branch: true
title: ${{ steps.pr-meta.outputs.title }}
body: |
${{ steps.pr-meta.outputs.body }}

This PR updates the `pnpm-lock.yaml` files in all E2E test applications.
commit-message: ${{ steps.pr-meta.outputs.commit }}
labels: |
CI & Build

- name: Enable squash automerge for PR
if: steps.create-pr.outputs.pull-request-number != ''
run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Auto approve PR
if: steps.create-pr.outputs.pull-request-number != ''
uses: hmarr/auto-approve-action@v4
with:
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
review-message: 'Auto approved automated PR'
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
tmp
.tmp_build_stdout
.tmp_build_stderr
pnpm-lock.yaml
.last-run.json
./pnpm-lock.yaml
6 changes: 6 additions & 0 deletions dev-packages/e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ Prerequisites: Docker
- Run `yarn build:tarball` in the root of the repository (needs to be rerun after every update in /packages for the
changes to have effect on the tests).

### Environment Variables

| Variable | Description |
|----------|-------------|
| `E2E_IGNORE_LOCKFILE` | Set to `true` to delete `pnpm-lock.yaml` before installing dependencies. This forces fresh dependency resolution, ignoring the committed lockfile. Used in CI on `develop`/`master` branches to catch compatibility issues early. |

To finally run all of the tests:

```bash
Expand Down
17 changes: 16 additions & 1 deletion dev-packages/e2e-tests/lib/copyToTemp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
import { readFileSync, writeFileSync } from 'fs';
import { readFileSync, unlinkSync, writeFileSync } from 'fs';
import { cp } from 'fs/promises';
import { join } from 'path';

Expand All @@ -8,6 +8,21 @@ export async function copyToTemp(originalPath: string, tmpDirPath: string): Prom
await cp(originalPath, tmpDirPath, { recursive: true });

fixPackageJson(tmpDirPath);

// On develop/master, we want to ignore the lock file to always test with fresh dependencies
if (process.env.E2E_IGNORE_LOCKFILE === 'true') {
deleteLockfile(tmpDirPath);
}
}

function deleteLockfile(cwd: string): void {
const lockfilePath = join(cwd, 'pnpm-lock.yaml');
try {
unlinkSync(lockfilePath);
console.log(`Deleted lockfile at ${lockfilePath} (E2E_IGNORE_LOCKFILE=true)`);
} catch {
// Lock file doesn't exist, that's fine
}
Comment on lines +23 to +25
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The code uses the environment variable E2E_IGNORE_LOCKFILE, but the PR description incorrectly refers to it as E2E_FRESH_LOCKFILE.
Severity: LOW

Suggested Fix

Update the pull request description to refer to the correct environment variable, E2E_IGNORE_LOCKFILE, to match the implementation and avoid confusion.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: dev-packages/e2e-tests/lib/copyToTemp.ts#L23-L25

Potential issue: The code checks for the environment variable `E2E_IGNORE_LOCKFILE` to
decide whether to delete a lockfile. However, the pull request description incorrectly
refers to this variable as `E2E_FRESH_LOCKFILE`. This inconsistency between the
implementation and the documentation can lead to confusion and configuration errors, as
a developer might set the wrong variable based on the description, causing the feature
to not work as intended.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad

}

function fixPackageJson(cwd: string): void {
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ci:build-matrix": "ts-node ./lib/getTestMatrix.ts",
"ci:build-matrix-optional": "ts-node ./lib/getTestMatrix.ts --optional=true",
"ci:copy-to-temp": "ts-node ./ciCopyToTemp.ts",
"clean:test-applications": "rimraf --glob test-applications/**/{node_modules,dist,build,.next,.nuxt,.sveltekit,.react-router,.astro,.output,pnpm-lock.yaml,.last-run.json,test-results,.angular,event-dumps}",
"clean:test-applications": "rimraf --glob test-applications/**/{node_modules,dist,build,.next,.nuxt,.sveltekit,.react-router,.astro,.output,.last-run.json,test-results,.angular,event-dumps}",
"clean:pnpm": "pnpm store prune"
},
"devDependencies": {
Expand Down
Loading
Loading