-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (69 loc) · 2.57 KB
/
Copy pathci.yml
File metadata and controls
88 lines (69 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# ── Job 1: unit tests (fast path — no browser needed) ────────────────────────
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Test (unit)
run: pnpm test
# ── Job 2: E2E smoke tests (requires Chromium) ───────────────────────────────
e2e:
name: E2E Smoke Tests
runs-on: ubuntu-latest
needs: unit # only run E2E if unit tests pass
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Cache the Chromium binary between runs.
# Key includes the patchright version so it invalidates on upgrades.
- name: Cache Patchright Chromium
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: patchright-chromium-${{ runner.os }}-${{ hashFiles('packages/core/package.json') }}
restore-keys: patchright-chromium-${{ runner.os }}-
- name: Install Patchright Chromium
run: pnpm --filter @browserkit-dev/core exec patchright install chromium
- name: Build
run: pnpm build
# Checkout adapter-hackernews and link it into the workspace for E2E tests.
- name: Checkout adapter-hackernews for E2E
uses: actions/checkout@v4
with:
repository: browserkit-dev/adapter-hackernews
path: packages/adapter-hackernews
- name: Link adapter-hackernews into workspace
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('packages/adapter-hackernews/package.json'));
pkg.devDependencies['@browserkit-dev/core'] = 'workspace:*';
fs.writeFileSync('packages/adapter-hackernews/package.json', JSON.stringify(pkg, null, 2));
"
pnpm install --no-frozen-lockfile
pnpm --filter @browserkit-dev/adapter-hackernews build
- name: Test (E2E smoke)
run: pnpm test:e2e
timeout-minutes: 5