forked from tinyhumansai/openhuman
-
Notifications
You must be signed in to change notification settings - Fork 0
405 lines (353 loc) · 13.3 KB
/
e2e-reusable.yml
File metadata and controls
405 lines (353 loc) · 13.3 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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
---
# Reusable E2E workflow — single source of truth for the desktop E2E recipe.
#
# Callers:
# - `.github/workflows/e2e.yml` — PR/push, Linux-only smoke (blocking).
# - `.github/workflows/release-staging.yml` — pretest gate, all 3 OS, full suite.
# - `.github/workflows/release-production.yml` — pretest gate, all 3 OS, full suite.
#
# Recipe per OS (identical across platforms — see e2e-run-session.sh):
# 1. Build the CEF app via `pnpm --filter openhuman-app test:e2e:build`.
# 2. Install Appium 3.x + the `chromium` driver.
# 3. Run `app/scripts/e2e-run-session.sh` which:
# - launches the built binary,
# - waits for CDP on :19222,
# - prunes the prewarm `about:blank` target,
# - downloads a chromedriver matching CEF's Chromium version,
# - starts Appium and runs WDIO against `wdio.conf.ts`.
#
# Linux runs inside the project CI container under Xvfb (no native display).
# macOS / Windows run on GitHub-hosted runners.
#
# Caching: pnpm store, Swatinem rust-cache, and CEF runtime download
# (~400MB) are cached on every job. The CEF cache key matches what
# build-desktop.yml uses so cross-workflow hits are possible.
name: E2E (reusable)
on:
workflow_call:
inputs:
ref:
description:
Git ref (tag or SHA) to test. Release workflows pass the
freshly-pushed staging/production tag here so pretest validates
the exact commit the build matrix will check out, not main HEAD
at workflow_dispatch time. Defaults to empty (checkout uses its
own default, i.e. the workflow's triggering ref).
type: string
default: ""
run_linux:
description: Run the Linux (Xvfb / container) E2E job.
type: boolean
default: true
run_macos:
description: Run the macOS E2E job.
type: boolean
default: false
run_windows:
description: Run the Windows E2E job.
type: boolean
default: false
full:
description:
When true, run the entire spec suite via `e2e-run-session.sh` (no
spec arg). When false, run the smoke spec + mega-flow (mega-flow
non-blocking). Releases set this to true; PR runs leave it false.
type: boolean
default: false
permissions:
contents: read
jobs:
e2e-linux:
if: inputs.run_linux
name: E2E (Linux / Appium Chromium)
runs-on: ubuntu-22.04
container:
image: ghcr.io/tinyhumansai/openhuman_ci:latest
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ inputs.ref }}
fetch-depth: 1
submodules: recursive
- name: Cache pnpm store
uses: actions/cache@v5
with:
path: ~/.local/share/pnpm/store
key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
app/src-tauri -> target
cache-on-failure: true
key: e2e-linux-unified
# CEF runtime download cache — matches the key shape used by
# build-desktop.yml so a release build and an E2E run on the same
# commit can share a single download.
- name: Cache CEF binary distribution
uses: actions/cache@v5
with:
path: |
~/.cache/tauri-cef
key: cef-x86_64-unknown-linux-gnu-${{ hashFiles('app/src-tauri/Cargo.toml') }}
restore-keys: |
cef-x86_64-unknown-linux-gnu-
- name: Cache Appium global install
uses: actions/cache@v5
with:
path: |
~/.appium
/usr/local/lib/node_modules/appium
key: appium3-chromium-${{ runner.os }}-v1
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Ensure .env exists for E2E build
run: |
touch .env
touch app/.env
- name: Install Appium and chromium driver
run: |
if ! command -v appium >/dev/null 2>&1; then
npm install -g appium@3
fi
# `appium driver list --installed` can miss cached installs on some
# Appium builds; install idempotently and ignore "already installed".
appium driver install --source=npm appium-chromium-driver >/dev/null 2>&1 || true
- name: Build E2E app
run: pnpm --filter openhuman-app test:e2e:build
- name: Run E2E (smoke)
if: ${{ !inputs.full }}
run: |
xvfb-run -a --server-args="-screen 0 1280x960x24" \
bash app/scripts/e2e-run-session.sh test/e2e/specs/smoke.spec.ts smoke
# Mega-flow exercises the OAuth-success-deep-link and Composio
# trigger-lifecycle paths. Hard-fails on regressions — if the
# deep-link → custom-event propagation race resurfaces, fix it
# at the source rather than re-adding `continue-on-error`.
- name: Run E2E (mega-flow)
if: ${{ !inputs.full }}
run: |
xvfb-run -a --server-args="-screen 0 1280x960x24" \
bash app/scripts/e2e-run-session.sh test/e2e/specs/mega-flow.spec.ts mega-flow
- name: Run E2E (full suite)
if: ${{ inputs.full }}
run: |
xvfb-run -a --server-args="-screen 0 1280x960x24" \
bash app/scripts/e2e-run-session.sh
# Artifact uploads intentionally omitted — this reusable workflow
# is invoked from release-staging.yml and release-production.yml,
# and uploaded logs can carry mock-backend payloads, env-var
# echoes, and CDP transcripts that we don't want pinned to a
# release artifact. Local repro: rerun the spec via Docker and
# the same logs land in /tmp.
# Rust-side E2E counterpart to the Tauri runs above. Same Linux-only
# scope (CI does not run this on macOS or Windows — the Rust core is
# platform-independent, so one OS is enough signal). Boots the same
# `scripts/mock-api-server.mjs` the Tauri specs hit, then runs every
# `tests/*_e2e.rs` suite against it.
rust-e2e-linux:
if: inputs.run_linux
name: E2E (Linux / Rust integration suite)
runs-on: ubuntu-22.04
container:
image: ghcr.io/tinyhumansai/openhuman_ci:latest
timeout-minutes: 60
env:
CARGO_INCREMENTAL: '0'
RUST_BACKTRACE: '1'
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ inputs.ref }}
fetch-depth: 1
submodules: recursive
- name: Cache pnpm store
uses: actions/cache@v5
with:
path: ~/.local/share/pnpm/store
key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
cache-on-failure: true
key: rust-e2e-linux
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Ensure .env exists for tests
run: |
touch .env
touch app/.env
- name: Run Rust E2E suite (tests/*_e2e.rs vs mock backend)
run: pnpm test:rust:e2e
# No artifact uploads here either — same release-workflow reuse
# concern as the Tauri job above. Mock-backend log lives at
# /tmp/openhuman-rust-e2e-mock.log for local docker repro.
e2e-macos:
if: inputs.run_macos
name: E2E (macOS / Appium Chromium)
runs-on: macos-latest
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ inputs.ref }}
fetch-depth: 1
submodules: recursive
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 24.x
cache: pnpm
- name: Install Rust (rust-toolchain.toml)
uses: dtolnay/rust-toolchain@1.93.0
with:
# macos-latest is arm64, but the vendored tauri-cli's build.rs
# compiles a CEF helper for x86_64-apple-darwin (universal binary),
# so the x86_64 libstd must be installed too.
targets: x86_64-apple-darwin
- name: Verify cargo resolves to real toolchain
run: |
rustup default 1.93.0 || true
which cargo
cargo --version
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
app/src-tauri -> target
cache-on-failure: true
key: e2e-macos-unified-v2
- name: Cache CEF binary distribution
uses: actions/cache@v5
with:
path: |
~/Library/Caches/tauri-cef
key: cef-aarch64-apple-darwin-${{ hashFiles('app/src-tauri/Cargo.toml') }}
restore-keys: |
cef-aarch64-apple-darwin-
- name: Cache Appium global install
uses: actions/cache@v5
with:
path: |
~/.appium
key: appium3-chromium-${{ runner.os }}-v1
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Ensure .env exists for E2E build
run: |
touch .env
touch app/.env
- name: Install Appium and chromium driver
run: |
if ! command -v appium >/dev/null 2>&1; then
npm install -g appium@3
fi
# `appium driver list --installed` can miss cached installs on some
# Appium builds; install idempotently and ignore "already installed".
appium driver install --source=npm appium-chromium-driver >/dev/null 2>&1 || true
- name: Build E2E app
run: pnpm --filter openhuman-app test:e2e:build
# macOS rejects dynamic-framework loads from unsigned bundles — adhoc
# signing satisfies the loader without a real developer-ID cert.
- name: Adhoc-sign the .app bundle
run: |
codesign --force --deep --sign - \
app/src-tauri/target/debug/bundle/macos/OpenHuman.app
codesign --verify --deep --verbose=2 \
app/src-tauri/target/debug/bundle/macos/OpenHuman.app
- name: Run E2E (smoke + mega-flow)
if: ${{ !inputs.full }}
run: |
bash app/scripts/e2e-run-session.sh test/e2e/specs/smoke.spec.ts smoke
bash app/scripts/e2e-run-session.sh test/e2e/specs/mega-flow.spec.ts mega-flow
- name: Run E2E (full suite)
if: ${{ inputs.full }}
run: bash app/scripts/e2e-run-session.sh
# Artifact uploads intentionally omitted — see e2e-linux for the
# reusable-workflow-is-also-used-by-releases rationale.
e2e-windows:
if: inputs.run_windows
name: E2E (Windows / Appium Chromium)
runs-on: windows-latest
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ inputs.ref }}
fetch-depth: 1
submodules: recursive
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 24.x
cache: pnpm
- name: Install Rust (rust-toolchain.toml)
uses: dtolnay/rust-toolchain@1.93.0
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
app/src-tauri -> target
cache-on-failure: true
key: e2e-windows-unified
- name: Cache CEF binary distribution
uses: actions/cache@v5
with:
path: |
~/AppData/Local/tauri-cef
key: cef-x86_64-pc-windows-msvc-${{ hashFiles('app/src-tauri/Cargo.toml') }}
restore-keys: |
cef-x86_64-pc-windows-msvc-
- name: Cache Appium global install
uses: actions/cache@v5
with:
path: |
~/.appium
key: appium3-chromium-${{ runner.os }}-v1
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Ensure .env exists for E2E build
shell: bash
run: |
touch .env
touch app/.env
- name: Install Appium and chromium driver
shell: bash
run: |
if ! command -v appium >/dev/null 2>&1; then
npm install -g appium@3
fi
# `appium driver list --installed` can miss cached installs on some
# Appium builds; install idempotently and ignore "already installed".
appium driver install --source=npm appium-chromium-driver >/dev/null 2>&1 || true
- name: Build E2E app
run: pnpm --filter openhuman-app test:e2e:build
- name: Run E2E (smoke + mega-flow)
if: ${{ !inputs.full }}
shell: bash
run: |
bash app/scripts/e2e-run-session.sh test/e2e/specs/smoke.spec.ts smoke
bash app/scripts/e2e-run-session.sh test/e2e/specs/mega-flow.spec.ts mega-flow
- name: Run E2E (full suite)
if: ${{ inputs.full }}
shell: bash
run: bash app/scripts/e2e-run-session.sh
# Artifact uploads intentionally omitted — see e2e-linux for the
# reusable-workflow-is-also-used-by-releases rationale.