Skip to content

Commit 79ebb64

Browse files
authored
Merge pull request evidence-dev#3031 from evidence-dev/ci/adjust-runner-style
[CI] - Use fewer runners for e2e testing
2 parents da6e522 + 3d28517 commit 79ebb64

2 files changed

Lines changed: 13 additions & 30 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,11 @@ on:
55
branches: [main, next]
66

77
jobs:
8-
find-e2e-test-projects:
9-
name: Find E2E Test Projects
10-
runs-on: ubuntu-latest
11-
outputs:
12-
e2e-test-projects: ${{ steps.e2e-test-projects.outputs.e2e-test-projects }}
13-
steps:
14-
- uses: actions/checkout@v4
15-
16-
- id: e2e-test-projects
17-
run: echo "e2e-test-projects=$(find e2e -maxdepth 1 -type d -printf "%f\n" | jq --raw-input --slurp --compact-output 'split("\n")[1:-1]')" >> ${GITHUB_OUTPUT}
18-
198
run-tests:
20-
needs:
21-
- find-e2e-test-projects
229
timeout-minutes: 60
2310
strategy:
2411
fail-fast: false
2512
matrix:
26-
project: ${{ fromJson(needs.find-e2e-test-projects.outputs.e2e-test-projects) }}
2713
os: [ubuntu-latest, macOS-latest, windows-latest]
2814
node-version: [18.13.0, 20, 22]
2915

@@ -34,7 +20,7 @@ jobs:
3420
- isMain: false
3521
node-version: 20
3622

37-
name: e2e/${{ matrix.project }}/${{ matrix.os }}/node-${{ matrix.node-version}}
23+
name: e2e/${{ matrix.os }}/node-${{ matrix.node-version}}
3824
runs-on: ${{ matrix.os }}
3925

4026
steps:
@@ -60,28 +46,23 @@ jobs:
6046
run: pnpm playwright install --with-deps
6147

6248
- name: Run setup
63-
working-directory: ./e2e/${{ matrix.project }}
64-
run: pnpm run --if-present setup
49+
run: pnpm --filter "./e2e/*" run --if-present setup
6550

6651
- name: Run sources
67-
working-directory: ./e2e/${{ matrix.project }}
68-
run: pnpm run sources
52+
run: pnpm --filter "./e2e/*" run sources
6953

7054
- name: Run dev mode tests
71-
working-directory: ./e2e/${{ matrix.project }}
72-
run: pnpm run test:dev
55+
run: pnpm --filter "./e2e/*" --sequential run test:dev
7356

7457
- name: Build
75-
working-directory: ./e2e/${{ matrix.project }}
76-
run: pnpm run build
58+
run: pnpm --filter "./e2e/*" run build
7759

7860
- name: Run preview mode tests
79-
working-directory: ./e2e/${{ matrix.project }}
80-
run: pnpm run test:preview
61+
run: pnpm --filter "./e2e/*" --sequential run test:preview
8162

8263
- name: Upload Playwright reports
8364
if: always()
8465
uses: actions/upload-artifact@v4
8566
with:
86-
name: playwright-report__e2e_${{ matrix.project }}_${{ matrix.os }}_node-${{ matrix.node-version }}
87-
path: e2e/${{ matrix.project }}/playwright-report
67+
name: playwright-report__e2e_${{ matrix.os }}_node-${{ matrix.node-version }}
68+
path: e2e/**/playwright-report

e2e/dev-server-startup/tests/tests.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test(`Should be timed appropriately`, async ({ page }) => {
2525
await fs.rm(`test.log`, { force: true });
2626

2727
const procStartTime = performance.now();
28-
const devServerProcess = child_process.spawn('npm', ['run', 'dev'], {
28+
const devServerProcess = child_process.spawn('npm', ['run', 'dev', '--', '--port', '18000'], {
2929
stdio: 'pipe',
3030
shell: true,
3131
env: {
@@ -67,7 +67,7 @@ test(`Should be timed appropriately`, async ({ page }) => {
6767
// await new Promise((r) => setTimeout(r, 20000));
6868
await fs.rm(`./.evidence/template/.evidence-queries`, { recursive: true, force: true });
6969
const reqStartTime = performance.now();
70-
await await fetch('http://localhost:3000?tag=the-real-request', {
70+
await await fetch('http://localhost:18000?tag=the-real-request', {
7171
headers: {
7272
'User-Agent': 'Birds ARE real :)'
7373
}
@@ -77,7 +77,7 @@ test(`Should be timed appropriately`, async ({ page }) => {
7777
const firstRequestDur = reqFinishTime - reqStartTime;
7878

7979
const loadStartTime = performance.now();
80-
await page.goto('http://localhost:3000');
80+
await page.goto('http://localhost:18000');
8181
await waitForPageToLoad(page);
8282
await expect(page.getByText('Magic Text 🪄')).toBeVisible();
8383
const lostFinishTime = performance.now();
@@ -118,6 +118,8 @@ test(`Should be timed appropriately`, async ({ page }) => {
118118
devServerProcess.kill();
119119
}
120120
});
121+
}).finally(() => {
122+
if (!devServerProcess.killed) devServerProcess.kill();
121123
});
122124
expect([0, null]).toContain(exitCode);
123125
});

0 commit comments

Comments
 (0)