Repository navigation
264 lines (257 loc) · 11.4 KB
/
Copy pathci.yml
File metadata and controls
264 lines (257 loc) · 11.4 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: CI
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
# the runner cache can hold a 24.x below the engines floor
check-latest: true
- name: Cache pnpm modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 10.26.1
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: 📦 Bundle
run: pnpm -r --workspace-concurrency=1 build
# Four tsc programs — see the `typecheck` script. Runs before the tests
# because it is fast and its failures are cheaper to read.
- name: 🔎 Typecheck
run: pnpm typecheck
# The conformance suite runs the Python adapter beside the JS ones; the `test` extra brings pytest, its runner.
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.13'
- name: Install the Python adapter
run: pip install -e 'packages/selenium-devtools-py[test]'
- name: 🧪 Run Tests
run: pnpm test
- name: Upload conformance report
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: conformance-report
path: packages/conformance/out/
if-no-files-found: ignore
# Separate job because these are the only tests that need a real browser, and
# they parallelise with `build` instead of extending it. No bundle step: the
# specs and packages/app/src reach @wdio/devtools-shared through its source
# exports, so Vite compiles everything from source. Chrome comes preinstalled
# on the runner image; wdio fetches the matching driver itself.
component-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
# the runner cache can hold a 24.x below the engines floor
check-latest: true
- name: Cache pnpm modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 10.26.1
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Two workers, not the runner default: each carries a Vite server plus a
# Chrome, and past 2 the heaviest specs time out under that contention.
- name: 🧩 Component Tests
run: pnpm test:ui --maxInstances 2
# Builds the hosted trace player, serves it under the headers vercel.json
# sends, and opens the committed older-format zips, a zip from this
# checkout's writer and a non-zip through it in headless Chrome, failing on
# any console error or CSP violation. Its own job: it needs only the app's
# hosted build, not the bundle the other jobs build, so it runs beside
# them. Chrome comes preinstalled on the runner image; WebdriverIO fetches
# the matching driver itself. scheduled-hosted-player.yml runs the same
# check against the deployed page.
hosted-player:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
# the runner cache can hold a 24.x below the engines floor
check-latest: true
- name: Cache pnpm modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 10.26.1
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Chrome version
run: google-chrome --version
- name: 🎞️ Hosted trace player end-to-end
run: pnpm player:e2e
# Runs one desktop example per adapter in trace mode against a local fixture
# site and checks each trace zip against
# packages/conformance/smoke/expectations/. The conformance suite covers the
# adapters against a fake browser; this covers the examples users copy, in a
# real headless Chrome (preinstalled on the runner image; each framework
# resolves its own driver). Mobile and Safari stay manual.
examples-smoke:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
# FIXTURE_DEFAULT_HOST/PORT in packages/conformance/smoke/constants.ts.
DEVTOOLS_EXAMPLE_BASE_URL: http://127.0.0.1:4567
DEVTOOLS_MODE: trace
DEVTOOLS_OPEN: '0'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
# the runner cache can hold a 24.x below the engines floor
check-latest: true
- name: Cache pnpm modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 10.26.1
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: 📦 Bundle
run: pnpm -r --workspace-concurrency=1 build
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.13'
- name: Install the Python adapter
run: pip install -e 'packages/selenium-devtools-py[test]'
- name: Chrome version
run: google-chrome --version
- name: Start the fixture site
id: fixture
run: |
nohup pnpm -s smoke:fixtures > "$RUNNER_TEMP/fixture-site.log" 2>&1 &
for _ in $(seq 1 30); do
curl -sf "$DEVTOOLS_EXAMPLE_BASE_URL/login" > /dev/null && exit 0
sleep 1
done
cat "$RUNNER_TEMP/fixture-site.log"
exit 1
# One step per example so a red step names it; each runs even when an
# earlier one failed.
- name: 🧪 WebdriverIO + Mocha (examples/wdio/mocha)
if: ${{ !cancelled() && steps.fixture.outcome == 'success' }}
run: bash .github/scripts/examples-smoke/run-example.sh wdio-mocha pnpm demo:wdio:mocha
- name: 🧪 Selenium + Mocha (examples/selenium-js/mocha)
if: ${{ !cancelled() && steps.fixture.outcome == 'success' }}
run: bash .github/scripts/examples-smoke/run-example.sh selenium-mocha pnpm --filter @wdio/selenium-devtools example:mocha
- name: 🧪 Nightwatch BDD (examples/nightwatch/bdd)
if: ${{ !cancelled() && steps.fixture.outcome == 'success' }}
run: bash .github/scripts/examples-smoke/run-example.sh nightwatch-bdd pnpm demo:nightwatch
# This job's DEVTOOLS_MODE=trace reaches the example through its conftest.py,
# whose defaults keep only failing tests' archives; one archive for the whole
# run is what the expectations describe, and `-o` outranks those defaults.
- name: 🧪 Python + pytest (examples/selenium-py/pytest)
if: ${{ !cancelled() && steps.fixture.outcome == 'success' }}
run: >-
bash .github/scripts/examples-smoke/run-example.sh python-pytest
python -m pytest examples/selenium-py/pytest
-o devtools_trace_policy=on -o devtools_trace_granularity=session
- name: Upload traces and run logs
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: examples-smoke
path: |
${{ runner.temp }}/examples-smoke/
${{ runner.temp }}/fixture-site.log
if-no-files-found: ignore
# The workspace develops against one WebdriverIO major, but the service and
# @wdio/elements declare peers on two. Each published major is installed from
# npm into a scratch project beside the packed tarballs, so a peer conflict, a
# broken entry point or a type mismatch with that major fails here first. 9
# runs too so a red 10 can be told apart from a broken harness.
wdio-peer:
name: wdio-peer (webdriverio ${{ matrix.wdio }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
wdio: [9, 10]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
# the runner cache can hold a 24.x below the engines floor
check-latest: true
- name: Cache pnpm modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 10.26.1
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The trailing `...` also builds what the two packages depend on, which
# includes the app the backend tarball serves.
- name: 📦 Bundle
run: pnpm --workspace-concurrency=1 --filter "@wdio/devtools-service..." --filter "@wdio/elements..." build
- name: 🔌 Install, import and type-check against WebdriverIO ${{ matrix.wdio }}
run: bash .github/scripts/wdio-peer-smoke/run.sh ${{ matrix.wdio }} "$RUNNER_TEMP/wdio-peer"