Skip to content

Commit c6ea042

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

3 files changed

Lines changed: 108 additions & 88 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: 104 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
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
15-
setup:
34+
build:
1635
runs-on: ubuntu-latest
1736
timeout-minutes: 10
1837
steps:
@@ -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,12 +83,54 @@ 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)
65-
auth-tests:
66-
needs: setup
88+
e2e-cli-tests:
89+
needs: build
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+
132+
web-cli-auth-tests:
133+
needs: build
67134
runs-on: ubuntu-latest
68135
timeout-minutes: 15
69136
env:
@@ -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,16 +176,14 @@ 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)
114-
session-tests:
115-
needs: setup
185+
web-cli-session-tests:
186+
needs: build
116187
runs-on: ubuntu-latest
117188
timeout-minutes: 20
118189
env:
@@ -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,17 +229,15 @@ 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)
164-
ui-tests:
165-
needs: setup
239+
web-cli-ui-tests:
240+
needs: build
166241
runs-on: ubuntu-latest
167242
timeout-minutes: 15
168243
env:
@@ -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,17 +283,15 @@ 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)
214-
rate-limit-test:
215-
needs: [auth-tests, session-tests, ui-tests]
293+
web-cli-rate-limit-test:
294+
needs: [web-cli-auth-tests, web-cli-session-tests, web-cli-ui-tests]
216295
runs-on: ubuntu-latest
217296
timeout-minutes: 10
218297
env:
@@ -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 \

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: 4 } },
7778
},
7879
},
7980
{

0 commit comments

Comments
 (0)