-
-
Notifications
You must be signed in to change notification settings - Fork 9
261 lines (232 loc) · 10.3 KB
/
Copy pathe2e-desktop.yml
File metadata and controls
261 lines (232 loc) · 10.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
# Reusable workflow: Desktop E2E tests (Linux + Windows)
# Call with workflow_call from ci.yml or e2e-desktop-comment.yml
name: E2E Desktop
on:
workflow_call:
inputs:
ref:
description: Git ref to checkout (e.g. PR head SHA or github.sha)
required: true
type: string
secrets:
TAURI_SIGNING_PRIVATE_KEY:
required: false
TAURI_SIGNING_PRIVATE_KEY_PASSWORD:
required: false
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
jobs:
e2e-desktop:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Install Linux deps
if: matrix.os == 'ubuntu-latest'
uses: ./.github/actions/install-linux-deps
with:
e2e: 'true'
- uses: dtolnay/rust-toolchain@stable
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-e2e-desktop
shared-key: rust-${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || 'x86_64-pc-windows-msvc' }}
cache-on-failure: true
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
# Cache pnpm store for faster installs
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Cache tauri-driver
uses: actions/cache@v4
id: tauri-driver-cache
with:
path: ~/.cargo/bin/tauri-driver*
key: tauri-driver-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install tauri-driver
if: steps.tauri-driver-cache.outputs.cache-hit != 'true'
run: cargo install tauri-driver --locked
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
# Cache Tauri CLI binary (avoid recompiling on every run)
- name: Cache Tauri CLI
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/cargo-tauri*
~/.cargo/bin/tauri*
key: tauri-cli-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
tauri-cli-${{ runner.os }}-
- run: pnpm install --frozen-lockfile
# E2E only needs a runnable app binary, not signed updater artifacts.
# Drop the `updater` bundle and disable updater-artifact creation so the
# build requires no signing key — fork PRs don't receive repository
# secrets, so requiring the key here makes every fork PR fail. Signed
# updater artifacts are produced by the release flow on trusted refs.
- name: Build app (Linux)
if: matrix.os == 'ubuntu-latest'
run: pnpm --filter @mcpmux/desktop exec tauri build --bundles deb,rpm --config '{"bundle":{"createUpdaterArtifacts":false}}'
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
- name: Build app (Windows)
if: matrix.os == 'windows-latest'
# shell: bash so the inline --config JSON is passed verbatim; PowerShell's
# native-argument handling would mangle the embedded double quotes.
shell: bash
run: pnpm --filter @mcpmux/desktop exec tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'
# TODO(playwright-migration): desktop E2E has stale assertions from the IA
# redesign and is being replaced (tauri-playwright spike). Non-blocking
# until then; results still surface via the report job below.
- name: Run desktop E2E tests (Linux)
if: matrix.os == 'ubuntu-latest'
continue-on-error: true
run: |
# Start dbus session and unlock gnome-keyring with a dummy password for CI.
# Two-step process: unlock creates the login keyring, start exports env vars.
# Use eval to robustly export GNOME_KEYRING_CONTROL so the keyring stays
# accessible across all test specs (avoids "unlock prompt was dismissed").
dbus-run-session -- bash -c '
echo "test" | gnome-keyring-daemon --unlock --components=secrets
eval "$(gnome-keyring-daemon --start --components=secrets)"
echo "GNOME_KEYRING_CONTROL=$GNOME_KEYRING_CONTROL"
sleep 1
xvfb-run --auto-servernum pnpm test:e2e
'
- name: Install matching EdgeDriver (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
# Tauri uses the WebView2 runtime, not Edge directly, so msedgedriver must be
# compatible with the WebView2 runtime (matching the major version is sufficient).
# Microsoft does not publish a driver for every exact runtime build, so try the
# exact version first, then fall back to the latest driver for the same major
# version, then LATEST_STABLE. This keeps the job from breaking whenever the
# runner's WebView2 build outpaces the published Edge drivers.
$ErrorActionPreference = 'Stop'
$wv2Key = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
if (-not (Test-Path $wv2Key)) { $wv2Key = 'HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' }
$wv2Version = (Get-ItemProperty $wv2Key).pv
$wv2Major = $wv2Version.Split('.')[0]
Write-Host "WebView2 runtime version: $wv2Version (major $wv2Major)"
# Microsoft locked down the old msedgewebdriverstorage blob (now returns HTTP 409
# "Public access is not permitted"); the current host is msedgedriver.microsoft.com.
$base = "https://msedgedriver.microsoft.com"
# Ordered list of candidate driver versions to try.
$candidates = [System.Collections.Generic.List[string]]::new()
$candidates.Add($wv2Version)
foreach ($marker in @("LATEST_RELEASE_${wv2Major}_WINDOWS", "LATEST_STABLE")) {
try {
$resolved = (Invoke-WebRequest -UseBasicParsing -Uri "$base/$marker").Content
# Markers are UTF-16/BOM encoded; keep only version characters.
$resolved = ($resolved -replace '[^0-9\.]', '').Trim()
if ($resolved) { $candidates.Add($resolved); Write-Host "marker $marker -> $resolved" }
} catch {
Write-Host "marker $marker unavailable: $($_.Exception.Message)"
}
}
$zipPath = "$env:TEMP\edgedriver.zip"
$extractDir = "$env:TEMP\edgedriver"
$ok = $false
foreach ($v in ($candidates | Select-Object -Unique)) {
$driverUrl = "$base/$v/edgedriver_win64.zip"
Write-Host "Trying EdgeDriver $v -> $driverUrl"
try {
Invoke-WebRequest -UseBasicParsing -Uri $driverUrl -OutFile $zipPath
Write-Host "Downloaded EdgeDriver $v"
$ok = $true
break
} catch {
Write-Host " not available: $($_.Exception.Message)"
}
}
if (-not $ok) { throw "No compatible msedgedriver found for WebView2 $wv2Version (tried: $($candidates -join ', '))" }
Expand-Archive -Path $zipPath -DestinationPath $extractDir -Force
$driverDir = "$extractDir\edgedriver_win64"
if (-not (Test-Path "$driverDir\msedgedriver.exe")) { $driverDir = $extractDir }
Write-Host "EdgeDriver path: $driverDir"
echo "$driverDir" | Out-File -Append -Encoding utf8 $env:GITHUB_PATH
- name: Run desktop E2E tests (Windows)
if: matrix.os == 'windows-latest'
continue-on-error: true
run: pnpm test:e2e
# Upload test results and artifacts
- name: Upload E2E test results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-desktop-results-${{ matrix.os }}
path: |
tests/e2e/reports/
tests/e2e/screenshots/
tests/e2e/videos/
retention-days: 7
# Publish E2E Desktop test results with separate checks per OS
e2e-report:
needs: [e2e-desktop]
if: always()
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Download all E2E test results
uses: actions/download-artifact@v4
with:
pattern: e2e-desktop-results-*
path: test-results
# Remove malformed/empty JUnit XMLs that crash dorny/test-reporter.
# This can happen when tauri-driver crashes mid-spec and the JUnit
# reporter writes incomplete XML (missing testsuites or test names).
- name: Sanitize JUnit XML reports
if: always()
run: |
for f in test-results/e2e-desktop-results-*/reports/*.xml; do
[ -f "$f" ] || continue
if ! grep -q '<testsuites' "$f" 2>/dev/null; then
echo "Removing malformed JUnit XML: $f"
rm "$f"
fi
done
- name: 'Report: E2E Desktop Tests (Linux)'
uses: dorny/test-reporter@v2
if: always()
with:
name: '🖥️ E2E Desktop Tests (Linux)'
path: test-results/e2e-desktop-results-ubuntu-latest/**/*.xml
reporter: java-junit
fail-on-error: false
- name: 'Report: E2E Desktop Tests (Windows)'
uses: dorny/test-reporter@v2
if: always()
with:
name: '🖥️ E2E Desktop Tests (Windows)'
path: test-results/e2e-desktop-results-windows-latest/**/*.xml
reporter: java-junit
fail-on-error: false