Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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 @@ -1031,6 +1031,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: Add pnpm overrides
run:
Expand Down Expand Up @@ -1147,6 +1150,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: Add pnpm overrides
run:
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/update-e2e-lockfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: 'Update E2E Lockfiles'

on:
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'
workflow_dispatch:

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: Prepare e2e tests
run: yarn test:prepare
working-directory: dev-packages/e2e-tests

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

- name: Update lockfiles
working-directory: dev-packages/e2e-tests
run: pnpm update --recursive --no-save --ignore-scripts

- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v7
with:
branch: chore/update-e2e-lockfiles
delete-branch: true
title: 'chore(e2e): Update pnpm lockfiles'
body: |
Automated daily update of E2E test application lockfiles.

This PR updates the `pnpm-lock.yaml` files in all E2E test applications.
commit-message: 'chore(e2e): update pnpm lockfiles'
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'
1 change: 0 additions & 1 deletion dev-packages/e2e-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
tmp
.tmp_build_stdout
.tmp_build_stderr
pnpm-lock.yaml
.last-run.json
packed
1 change: 1 addition & 0 deletions dev-packages/e2e-tests/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shared-workspace-lockfile=false
6 changes: 6 additions & 0 deletions dev-packages/e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ current state.
- 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 { isAbsolute, join, resolve } 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
}
}

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 @@ -16,7 +16,7 @@
"ci:build-matrix-optional": "node ./lib/getTestMatrix.mjs --optional=true",
"ci:copy-to-temp": "ts-node ./ciCopyToTemp.ts",
"ci:pnpm-overrides": "ts-node ./ciPnpmOverrides.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