Skip to content

Commit 4da1a93

Browse files
committed
chore(e2e-tests): Add a pnpm-lock file to every e2e test folder
1 parent 8ffd1de commit 4da1a93

File tree

227 files changed

+458088
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+458088
-120
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,9 @@ jobs:
10081008
- name: Copy to temp
10091009
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
10101010
working-directory: dev-packages/e2e-tests
1011+
env:
1012+
# On develop/master, ignore lockfiles to test with fresh dependencies
1013+
E2E_IGNORE_LOCKFILE: ${{ github.event_name != 'pull_request' }}
10111014

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

11381144
- name: Build E2E app
11391145
working-directory: ${{ runner.temp }}/test-application
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 'Release: Update E2E Lockfiles'
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update-lockfiles:
9+
uses: ./.github/workflows/update-e2e-lockfiles.yml
10+
with:
11+
sentry_only: true
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: 'Update E2E Lockfiles'
2+
3+
on:
4+
schedule:
5+
# Run every day at midnight UTC
6+
- cron: '0 0 * * *'
7+
workflow_dispatch:
8+
inputs:
9+
sentry_only:
10+
description: 'Only update @sentry/* packages'
11+
type: boolean
12+
default: false
13+
workflow_call:
14+
inputs:
15+
sentry_only:
16+
description: 'Only update @sentry/* packages'
17+
type: boolean
18+
default: true
19+
20+
env:
21+
CACHED_DEPENDENCY_PATHS: |
22+
${{ github.workspace }}/node_modules
23+
${{ github.workspace }}/packages/*/node_modules
24+
${{ github.workspace }}/dev-packages/*/node_modules
25+
26+
jobs:
27+
update-lockfiles:
28+
name: Update E2E Lockfiles
29+
runs-on: ubuntu-24.04
30+
timeout-minutes: 60
31+
permissions:
32+
pull-requests: write
33+
contents: write
34+
steps:
35+
- name: Check out develop branch
36+
uses: actions/checkout@v6
37+
with:
38+
ref: develop
39+
40+
- name: Set up Node
41+
uses: actions/setup-node@v6
42+
with:
43+
node-version-file: 'package.json'
44+
45+
- name: Set up pnpm
46+
uses: pnpm/action-setup@v4
47+
with:
48+
version: 9.15.9
49+
50+
- name: Install Dependencies
51+
uses: ./.github/actions/install-dependencies
52+
53+
- name: Build packages
54+
run: yarn build
55+
56+
- name: Build tarballs
57+
run: yarn build:tarball
58+
59+
- name: Get node version
60+
id: versions
61+
run: |
62+
echo "node=$(jq -r '.volta.node' package.json)" >> $GITHUB_OUTPUT
63+
64+
- name: Validate Verdaccio
65+
run: yarn test:validate
66+
working-directory: dev-packages/e2e-tests
67+
68+
- name: Prepare Verdaccio
69+
run: yarn test:prepare
70+
working-directory: dev-packages/e2e-tests
71+
env:
72+
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
73+
74+
- name: Update lockfiles
75+
working-directory: dev-packages/e2e-tests
76+
run: |
77+
for dir in test-applications/*/; do
78+
if [ -f "$dir/package.json" ]; then
79+
echo "Updating: $dir"
80+
if [ "${{ inputs.sentry_only }}" = "true" ]; then
81+
(cd "$dir" && pnpm update "@sentry/*" --ignore-scripts) || echo "Failed: $dir"
82+
else
83+
# Update all dependencies (including transitives) to latest within allowed ranges
84+
# --no-save keeps package.json unchanged, only updates the lockfile
85+
(cd "$dir" && pnpm update --no-save --ignore-scripts) || echo "Failed: $dir"
86+
fi
87+
fi
88+
done
89+
90+
- name: Set PR metadata
91+
id: pr-meta
92+
run: |
93+
if [ "${{ inputs.sentry_only }}" = "true" ]; then
94+
echo "title=chore(e2e): Update @sentry/* in lockfiles" >> $GITHUB_OUTPUT
95+
echo "commit=chore(e2e): update @sentry/* in lockfiles" >> $GITHUB_OUTPUT
96+
echo "body=Automated update of @sentry/* packages in E2E test application lockfiles after release." >> $GITHUB_OUTPUT
97+
else
98+
echo "title=chore(e2e): Update pnpm lockfiles" >> $GITHUB_OUTPUT
99+
echo "commit=chore(e2e): update pnpm lockfiles" >> $GITHUB_OUTPUT
100+
echo "body=Automated daily update of E2E test application lockfiles." >> $GITHUB_OUTPUT
101+
fi
102+
103+
- name: Create Pull Request
104+
id: create-pr
105+
uses: peter-evans/create-pull-request@v7
106+
with:
107+
branch: chore/update-e2e-lockfiles
108+
delete-branch: true
109+
title: ${{ steps.pr-meta.outputs.title }}
110+
body: |
111+
${{ steps.pr-meta.outputs.body }}
112+
113+
This PR updates the `pnpm-lock.yaml` files in all E2E test applications.
114+
commit-message: ${{ steps.pr-meta.outputs.commit }}
115+
labels: |
116+
CI & Build
117+
118+
- name: Enable squash automerge for PR
119+
if: steps.create-pr.outputs.pull-request-number != ''
120+
run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"
121+
env:
122+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
124+
- name: Auto approve PR
125+
if: steps.create-pr.outputs.pull-request-number != ''
126+
uses: hmarr/auto-approve-action@v4
127+
with:
128+
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
129+
review-message: 'Auto approved automated PR'

dev-packages/e2e-tests/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
tmp
33
.tmp_build_stdout
44
.tmp_build_stderr
5-
pnpm-lock.yaml
65
.last-run.json
6+
./pnpm-lock.yaml

dev-packages/e2e-tests/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ Prerequisites: Docker
2323
- Run `yarn build:tarball` in the root of the repository (needs to be rerun after every update in /packages for the
2424
changes to have effect on the tests).
2525

26+
### Environment Variables
27+
28+
| Variable | Description |
29+
|----------|-------------|
30+
| `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. |
31+
2632
To finally run all of the tests:
2733

2834
```bash

dev-packages/e2e-tests/lib/copyToTemp.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-console */
2-
import { readFileSync, writeFileSync } from 'fs';
2+
import { readFileSync, unlinkSync, writeFileSync } from 'fs';
33
import { cp } from 'fs/promises';
44
import { join } from 'path';
55

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

1010
fixPackageJson(tmpDirPath);
11+
12+
// On develop/master, we want to ignore the lock file to always test with fresh dependencies
13+
if (process.env.E2E_IGNORE_LOCKFILE === 'true') {
14+
deleteLockfile(tmpDirPath);
15+
}
16+
}
17+
18+
function deleteLockfile(cwd: string): void {
19+
const lockfilePath = join(cwd, 'pnpm-lock.yaml');
20+
try {
21+
unlinkSync(lockfilePath);
22+
console.log(`Deleted lockfile at ${lockfilePath} (E2E_IGNORE_LOCKFILE=true)`);
23+
} catch {
24+
// Lock file doesn't exist, that's fine
25+
}
1126
}
1227

1328
function fixPackageJson(cwd: string): void {

dev-packages/e2e-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"ci:build-matrix": "ts-node ./lib/getTestMatrix.ts",
1818
"ci:build-matrix-optional": "ts-node ./lib/getTestMatrix.ts --optional=true",
1919
"ci:copy-to-temp": "ts-node ./ciCopyToTemp.ts",
20-
"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}",
20+
"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}",
2121
"clean:pnpm": "pnpm store prune"
2222
},
2323
"devDependencies": {

0 commit comments

Comments
 (0)