Skip to content

Commit 941d72d

Browse files
committed
tackles some CI inefficiencies
1 parent 00a97fd commit 941d72d

4 files changed

Lines changed: 99 additions & 96 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/e2e-web-cli-parallel.yml renamed to .github/workflows/e2e.yml

Lines changed: 95 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
1-
name: Web CLI E2E Tests (Parallel)
1+
name: E2E Tests
22

33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- 'src/**'
8+
- 'test/**'
9+
- 'package.json'
10+
- 'pnpm-lock.yaml'
11+
- 'tsconfig.json'
12+
- 'scripts/**'
13+
- 'packages/**'
14+
- 'examples/**'
15+
- '.github/workflows/e2e.yml'
616
pull_request:
717
branches: [main]
18+
paths:
19+
- 'src/**'
20+
- 'test/**'
21+
- 'package.json'
22+
- 'pnpm-lock.yaml'
23+
- 'tsconfig.json'
24+
- 'scripts/**'
25+
- 'packages/**'
26+
- 'examples/**'
27+
- '.github/workflows/e2e.yml'
828

929
concurrency:
1030
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1131
cancel-in-progress: true
1232

1333
jobs:
14-
# Shared setup job to build once and share artifacts
1534
setup:
1635
runs-on: ubuntu-latest
1736
timeout-minutes: 10
@@ -47,6 +66,12 @@ jobs:
4766
cd examples/web-cli
4867
pnpm build
4968
69+
- name: Cache Playwright browsers
70+
uses: actions/cache@v4
71+
with:
72+
path: ~/.cache/ms-playwright
73+
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
74+
5075
- name: Install Playwright
5176
run: pnpm exec playwright install --with-deps chromium
5277

@@ -58,10 +83,52 @@ jobs:
5883
dist/
5984
packages/react-web-cli/dist/
6085
examples/web-cli/dist/
61-
node_modules/.cache/
6286
retention-days: 1
6387

64-
# Group 1: Authentication & Security Tests (18 tests)
88+
e2e-cli:
89+
needs: setup
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 15
92+
env:
93+
NO_COLOR: 1
94+
E2E_ABLY_API_KEY: ${{ secrets.E2E_ABLY_API_KEY }}
95+
E2E_ABLY_ACCESS_TOKEN: ${{ secrets.E2E_ABLY_ACCESS_TOKEN }}
96+
TERMINAL_SERVER_SIGNING_SECRET: ${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }}
97+
E2E_TESTS: true
98+
99+
steps:
100+
- name: Checkout code
101+
uses: actions/checkout@v4
102+
103+
- name: Set up pnpm
104+
uses: pnpm/action-setup@v3
105+
with:
106+
version: 10
107+
108+
- name: Set up Node.js
109+
uses: actions/setup-node@v4
110+
with:
111+
node-version: "22.x"
112+
cache: "pnpm"
113+
114+
- name: Install dependencies
115+
run: pnpm install --frozen-lockfile
116+
117+
- name: Download build artifacts
118+
uses: actions/download-artifact@v4
119+
with:
120+
name: build-artifacts
121+
122+
- name: Set up test environment
123+
run: |
124+
echo "ABLY_API_KEY=${{ secrets.E2E_ABLY_API_KEY }}" > .env.test
125+
echo "E2E_ABLY_API_KEY=${{ secrets.E2E_ABLY_API_KEY }}" >> .env.test
126+
echo "E2E_ABLY_ACCESS_TOKEN=${{ secrets.E2E_ABLY_ACCESS_TOKEN }}" >> .env.test
127+
echo "TERMINAL_SERVER_SIGNING_SECRET=${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }}" >> .env.test
128+
129+
- name: Run E2E CLI Tests
130+
run: pnpm test:e2e
131+
65132
auth-tests:
66133
needs: setup
67134
runs-on: ubuntu-latest
@@ -93,6 +160,12 @@ jobs:
93160
- name: Install dependencies
94161
run: pnpm install --frozen-lockfile
95162

163+
- name: Cache Playwright browsers
164+
uses: actions/cache@v4
165+
with:
166+
path: ~/.cache/ms-playwright
167+
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
168+
96169
- name: Install Playwright
97170
run: pnpm exec playwright install --with-deps chromium
98171

@@ -103,14 +176,12 @@ jobs:
103176

104177
- name: Run Authentication & Security Tests
105178
run: |
106-
echo "Running Authentication & Security Tests..."
107179
pnpm exec playwright test \
108180
--config test/e2e/web-cli/playwright.config.ts \
109181
test/e2e/web-cli/authentication.test.ts \
110182
test/e2e/web-cli/domain-scoped-auth.test.ts \
111183
--reporter=json,html
112184
113-
# Group 2: Session & Reconnection Tests (10 tests)
114185
session-tests:
115186
needs: setup
116187
runs-on: ubuntu-latest
@@ -142,6 +213,12 @@ jobs:
142213
- name: Install dependencies
143214
run: pnpm install --frozen-lockfile
144215

216+
- name: Cache Playwright browsers
217+
uses: actions/cache@v4
218+
with:
219+
path: ~/.cache/ms-playwright
220+
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
221+
145222
- name: Install Playwright
146223
run: pnpm exec playwright install --with-deps chromium
147224

@@ -152,15 +229,13 @@ jobs:
152229

153230
- name: Run Session & Reconnection Tests
154231
run: |
155-
echo "Running Session & Reconnection Tests..."
156232
pnpm exec playwright test \
157233
--config test/e2e/web-cli/playwright.config.ts \
158234
test/e2e/web-cli/session-resume.test.ts \
159235
test/e2e/web-cli/reconnection.test.ts \
160236
test/e2e/web-cli/reconnection-diagnostic.test.ts \
161237
--reporter=json,html
162238
163-
# Group 3: UI & Core Features Tests (8 tests)
164239
ui-tests:
165240
needs: setup
166241
runs-on: ubuntu-latest
@@ -192,6 +267,12 @@ jobs:
192267
- name: Install dependencies
193268
run: pnpm install --frozen-lockfile
194269

270+
- name: Cache Playwright browsers
271+
uses: actions/cache@v4
272+
with:
273+
path: ~/.cache/ms-playwright
274+
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
275+
195276
- name: Install Playwright
196277
run: pnpm exec playwright install --with-deps chromium
197278

@@ -202,15 +283,13 @@ jobs:
202283

203284
- name: Run UI & Core Features Tests
204285
run: |
205-
echo "Running UI & Core Features Tests..."
206286
pnpm exec playwright test \
207287
--config test/e2e/web-cli/playwright.config.ts \
208288
test/e2e/web-cli/terminal-ui.test.ts \
209289
test/e2e/web-cli/web-cli.test.ts \
210290
test/e2e/web-cli/prompt-integrity.test.ts \
211291
--reporter=json,html
212292
213-
# Group 4: Rate Limit Test (1 test - must run last)
214293
rate-limit-test:
215294
needs: [auth-tests, session-tests, ui-tests]
216295
runs-on: ubuntu-latest
@@ -243,6 +322,12 @@ jobs:
243322
- name: Install dependencies
244323
run: pnpm install --frozen-lockfile
245324

325+
- name: Cache Playwright browsers
326+
uses: actions/cache@v4
327+
with:
328+
path: ~/.cache/ms-playwright
329+
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
330+
246331
- name: Install Playwright
247332
run: pnpm exec playwright install --with-deps chromium
248333

@@ -253,7 +338,6 @@ jobs:
253338

254339
- name: Run Rate Limit Test
255340
run: |
256-
echo "Running Rate Limit Test..."
257341
pnpm exec playwright test \
258342
--config test/e2e/web-cli/playwright.config.ts \
259343
test/e2e/web-cli/z-rate-limit-trigger.test.ts \

test/setup.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { config } from "dotenv";
33
import { resolve } from "node:path";
44
import { existsSync } from "node:fs";
5-
import { exec } from "node:child_process";
65
import * as Ably from "ably";
76

87
// Import types for test mocks
@@ -90,22 +89,6 @@ export async function cleanupGlobalProcesses(): Promise<void> {
9089

9190
globalProcessRegistry.clear();
9291
}
93-
94-
// Also kill any processes matching our patterns
95-
try {
96-
await new Promise<void>((resolve) => {
97-
exec('pkill -f "bin/run.js.*subscribe"', () => {
98-
resolve();
99-
});
100-
});
101-
await new Promise<void>((resolve) => {
102-
exec('pkill -f "ably.*subscribe"', () => {
103-
resolve();
104-
});
105-
});
106-
} catch {
107-
// Ignore errors
108-
}
10992
}
11093

11194
/**

vitest.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ export default defineConfig({
7171
},
7272
testTimeout: 20000, // Allow 20s per test for plenty of time on actions
7373
hookTimeout: 60000, // 60 seconds for hooks
74-
// Run e2e tests sequentially to avoid API rate limits
75-
sequence: { shuffle: false },
76-
fileParallelism: false,
74+
// Limit parallel e2e files — each spawns CLI subprocesses with live
75+
// WebSocket connections; too many concurrent files overwhelms CI
76+
pool: "forks",
77+
poolOptions: { forks: { maxForks: 5 } },
7778
},
7879
},
7980
{

0 commit comments

Comments
 (0)