Repository navigation
389 lines (371 loc) · 17.6 KB
/
Copy pathwebview_apple_smoke.yml
File metadata and controls
389 lines (371 loc) · 17.6 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
name: Apple native smoke (WebView and installed PDF)
# Native coverage for WebView and installed PDF runtime changes. This is a
# functional scenario; it does not claim representative CPU/GPU/RAM savings.
on:
pull_request:
paths:
- 'pubspec.yaml'
- 'pubspec.lock'
- 'integration_test/webview_resource_probe_test.dart'
- 'integration_test/perf_resource_probe_test.dart'
- 'integration_test/support/perf_*.dart'
- 'integration_test/support/webview_probe_*.dart'
- 'integration_test/installed_plugin_resource_probe_test.dart'
- 'integration_test/installed_pdf_ios_probe_test.dart'
- 'integration_test/support/installed_plugin_*.dart'
- 'test_driver/installed_plugin_resource_probe.dart'
- 'test/tool/perf_probe/installed_plugin_pdf*_test.dart'
- 'test/tool/perf_probe/fixtures/installed_pdf_*.json'
- 'test_driver/webview_resource_probe.dart'
- 'tool/perf_probe/prepare_installed_plugin_source.py'
- 'tool/perf_probe/src/installed_pdf_*_contract.dart'
- 'tool/perf_probe/src/installed_plugin_contract.dart'
- 'tool/perf_probe/validate_installed_plugin_macos.py'
- 'tool/perf_probe/installed_pdf_*.py'
- 'tool/perf_probe/test_installed_pdf_desktop.py'
- 'tool/perf_probe/run_installed_pdf_ios.py'
- 'tool/perf_probe/test_installed_pdf_ios.py'
- 'tool/perf_probe/test_installed_plugin_macos.py'
- 'tool/perf_probe/validate_webview_apple_smoke.py'
- 'tool/perf_probe/test_webview_apple_smoke_validator.py'
- 'tool/perf_probe/*posix*.py'
- 'tool/perf_probe/validate_perf_probe_smoke.py'
- 'tool/perf_probe/validate_pdf_multi_window.dart'
- 'test/tool/perf_probe/pdf_multi_window_test.dart'
- 'lib/core/windowing/**'
- 'tool/perf_probe/probe_binding.py'
- 'tool/perf_probe/framework_pdf_probe.dart'
- 'tool/perf_probe/src/probe_*.dart'
- 'integration_test/support/perf_resource_workload.dart'
- 'integration_test/support/perf_framework_scheduler.dart'
- 'tool/perf_probe/prepare_pdf_case.dart'
- 'tool/perf_probe/analyze.dart'
- 'tool/perf_probe/src/pdf_*.dart'
- 'tool/perf_probe/src/report.dart'
- 'lib/pdf_book/**'
- 'lib/indexing/**'
- 'lib/printing/**'
- '.github/workflows/webview_apple_smoke.yml'
workflow_dispatch:
inputs:
platform:
description: Platform to test (iOS runs on a Simulator)
type: choice
options: [ios, macos]
default: ios
permissions:
contents: read
concurrency:
group: apple-webview-smoke-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
gate:
uses: ./.github/workflows/ci_gate.yml
permissions:
contents: read
pull-requests: read
report-contracts:
name: Fail-closed Apple report contract tests
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7.0.1
- name: Verify accepted and rejected native report shapes
run: |
python3 -m unittest -v \
tool/perf_probe/test_webview_apple_smoke_validator.py \
tool/perf_probe/test_installed_plugin_macos.py \
tool/perf_probe/test_installed_pdf_ios.py \
tool/perf_probe/test_installed_pdf_desktop.py
portable-webview:
if: needs.gate.outputs.run == 'true'
needs: [gate, report-contracts]
name: Native Apple app / ${{ inputs.platform || 'macos' }}
runs-on: macos-latest
timeout-minutes: 90
env:
CI: 'true'
BOT: 'true'
FLUTTER_SUPPRESS_ANALYTICS: 'true'
DART_SUPPRESS_ANALYTICS: 'true'
PYTHONDONTWRITEBYTECODE: '1'
CARGO_NET_GIT_FETCH_WITH_CLI: 'true'
GH_TOKEN: ${{ github.token }}
WEBVIEW_PROBE_DEVICE_OUTPUT: ''
# iOS stays manual while intermittent scroll restoration is investigated.
PROBE_PLATFORM: ${{ inputs.platform || 'macos' }}
PROBE_MODE: ${{ inputs.platform == 'ios' && 'debug' || 'profile' }}
steps:
- uses: actions/checkout@v7.0.1
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.47.9
cache: false
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v7.1.0
with:
# waitid/WNOWAIT requires Python 3.13+ on macOS.
python-version: '3.15'
- name: Capture exact host and source provenance
shell: bash
run: |
set -euo pipefail
{
echo "WEBVIEW_PROBE_REPORTS=$RUNNER_TEMP/apple-webview-reports"
echo "PERF_POSIX_ROOT=$RUNNER_TEMP/perf-posix-macos"
} >> "$GITHUB_ENV"
mkdir -p "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM"
sw_vers > "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/os.txt"
uname -a >> "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/os.txt"
xcodebuild -version > "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/xcode.txt"
flutter --version --machine > "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/flutter.json"
git rev-parse HEAD > "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/source-commit.txt"
git rev-parse 'HEAD^{tree}' > "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/source-tree.txt"
- name: Resolve locked dependencies
shell: bash
run: |
set -euo pipefail
flutter pub get --enforce-lockfile 2>&1 | tee "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/pub-get.log"
- name: Create only an owned iOS Simulator
if: env.PROBE_PLATFORM == 'ios'
shell: bash
run: |
set -euo pipefail
export PROBE_RECEIPT="$RUNNER_TEMP/apple-webview-ios/simulator-id.txt"
python3 - <<'PY'
import json, os, pathlib, subprocess
runtimes = json.loads(subprocess.check_output(['xcrun','simctl','list','-j','runtimes']))['runtimes']
available = [r for r in runtimes if r.get('isAvailable') and
r['identifier'].startswith('com.apple.CoreSimulator.SimRuntime.iOS-')]
installed = json.loads(subprocess.check_output(['xcrun','simctl','list','-j','devices']))['devices']
compatible = []
for runtime_info in available:
runtime_id = runtime_info['identifier']
for entry in installed.get(runtime_id, []):
kind = entry.get('deviceTypeIdentifier', '')
if entry.get('isAvailable') and kind.startswith('com.apple.CoreSimulator.SimDeviceType.iPhone-'):
compatible.append((runtime_info, entry))
if not compatible:
raise SystemExit('No iOS runtime with a known-compatible iPhone device — NOT_RUN')
def version(entry):
return tuple(int(x) for x in entry[0].get('version', '0').split('.') if x.isdigit())
selected, prototype = max(compatible, key=version)
runtime = selected['identifier']
device = prototype['deviceTypeIdentifier']
name='otzaria-webview-' + os.environ['GITHUB_RUN_ID'] + '-' + os.environ['GITHUB_RUN_ATTEMPT']
sim=subprocess.check_output(['xcrun','simctl','create',name,device,runtime],text=True).strip()
pathlib.Path(os.environ['PROBE_RECEIPT']).write_text(sim+'\n')
print('Created owned simulator',sim,'runtime',runtime,'device type',device)
PY
sim="$(cat "$PROBE_RECEIPT")"
xcrun simctl boot "$sim"
xcrun simctl bootstatus "$sim" -b
flutter devices --machine > "$RUNNER_TEMP/apple-webview-ios/devices.json"
- name: Run real native WebView scenario (no mocks, no threshold waivers)
timeout-minutes: 35
shell: bash
run: |
set -euo pipefail
target=macos
if [ "$PROBE_PLATFORM" = ios ]; then
target="$(cat "$RUNNER_TEMP/apple-webview-ios/simulator-id.txt")"
fi
flutter drive --"$PROBE_MODE" -d "$target" --no-pub \
--driver=test_driver/webview_resource_probe.dart \
--target=integration_test/webview_resource_probe_test.dart \
--dart-define=WEBVIEW_PROBE_FLUTTER_VERSION=3.47.9 \
--dart-define=WEBVIEW_PROBE_COMMIT=${{ github.sha }} \
--dart-define=WEBVIEW_PROBE_TABS=3 \
--dart-define=WEBVIEW_PROBE_IDLE_MS=3000 \
2>&1 | tee "$RUNNER_TEMP/apple-webview-$PROBE_PLATFORM/run.log"
- name: Validate complete real device report
shell: bash
run: |
set -euo pipefail
python3 tool/perf_probe/validate_webview_apple_smoke.py \
--root "$WEBVIEW_PROBE_REPORTS" \
--platform "$PROBE_PLATFORM" \
--mode "$PROBE_MODE" \
--commit "$GITHUB_SHA"
- name: Prepare the installed macOS PDF scenario
if: env.PROBE_PLATFORM == 'macos'
shell: bash
env:
INSTALLED_PROBE_ROOT: ${{ runner.temp }}/apple-installed-pdf
run: |
set -euo pipefail
test ! -e "$INSTALLED_PROBE_ROOT"
mkdir -p "$INSTALLED_PROBE_ROOT"
python3 tool/perf_probe/prepare_installed_plugin_source.py \
--output "$INSTALLED_PROBE_ROOT/store-source" \
2>&1 | tee "$INSTALLED_PROBE_ROOT/source.log"
flutter test --no-pub --concurrency=1 --reporter expanded \
test/tool/perf_probe/installed_plugin_pdf_macos_test.dart \
test/tool/perf_probe/installed_plugin_pdf_runtime_test.dart test/tool/perf_probe/installed_plugin_pdf_desktop_test.dart test/tool/perf_probe/installed_plugin_memory_pressure_test.dart \
test/tool/perf_probe/installed_plugin_pdf_fixture_test.dart \
2>&1 | tee "$INSTALLED_PROBE_ROOT/contracts.log"
- name: Run viewing, indexing and printing in the macOS profile app
if: env.PROBE_PLATFORM == 'macos'
timeout-minutes: 35
shell: bash
env:
INSTALLED_PROBE_DATA: ${{ runner.temp }}/apple-installed-pdf/data
INSTALLED_PROBE_OUTPUT: ${{ runner.temp }}/apple-installed-pdf/device
INSTALLED_PROBE_REPORTS: ${{ runner.temp }}/apple-installed-pdf/host
INSTALLED_PROBE_STORE_SOURCE: ${{ runner.temp }}/apple-installed-pdf/store-source
INSTALLED_PROBE_MACHINE_ID: ${{ github.run_id }}-${{ github.run_attempt }}-macos
run: |
set -euo pipefail
flutter drive --profile -d macos --no-dds --no-pub \
--driver=test_driver/installed_plugin_resource_probe.dart \
--target=integration_test/installed_plugin_resource_probe_test.dart \
--dart-define=INSTALLED_PROBE_FLUTTER_VERSION=3.47.9 \
--dart-define=INSTALLED_PROBE_COMMIT="$GITHUB_SHA" \
--dart-define=INSTALLED_PROBE_IDLE_MS=1500 \
2>&1 | tee "$RUNNER_TEMP/apple-installed-pdf/run.log"
- name: Verify actual macOS app images, PDF output and teardown
if: env.PROBE_PLATFORM == 'macos'
shell: bash
run: |
set -euo pipefail
python3 tool/perf_probe/validate_installed_plugin_macos.py \
--root "$RUNNER_TEMP/apple-installed-pdf/host" \
--products build/macos/Build/Products/Profile \
--output "$RUNNER_TEMP/apple-installed-pdf/device" \
--commit "$GITHUB_SHA" \
2>&1 | tee "$RUNNER_TEMP/apple-installed-pdf/verified-result.json"
- name: Measure the actual PDF reader with the POSIX profile runner
if: env.PROBE_PLATFORM == 'macos'
timeout-minutes: 45
shell: bash
run: |
set -euo pipefail
test ! -e "$PERF_POSIX_ROOT"
mkdir "$PERF_POSIX_ROOT"
python3 -m unittest tool.perf_probe.test_perf_probe_posix -v \
2>&1 | tee "$PERF_POSIX_ROOT/contracts.log"
printf '%s\n' '{"schemaVersion":1,"source":{"kind":"generated","pageCount":600}}' \
> "$PERF_POSIX_ROOT/case-input.json"
python3 tool/perf_probe/run_perf_probe_posix.py \
--mode profile --cache-state cold --scenario-set pdf-reader --binding-mode framework \
--pdf-case "$PERF_POSIX_ROOT/case-input.json" \
--warmup 0 --repetitions 1 --launches 1 --display-mode desktop \
--hardware-id "$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT-macos-desktop" \
--build-timeout-seconds 1200 --timeout-seconds 180 \
--output "$PERF_POSIX_ROOT/framework-run" \
2>&1 | tee "$PERF_POSIX_ROOT/framework-run.log"
python3 tool/perf_probe/validate_perf_probe_smoke.py \
--root "$PERF_POSIX_ROOT/framework-run" --binding-mode framework --platform macos --commit "$GITHUB_SHA" \
| tee "$PERF_POSIX_ROOT/verified-framework.json"
printf '%s\n' '{"schemaVersion":1,"source":{"kind":"generated","pageCount":10}}' \
> "$PERF_POSIX_ROOT/multi-window-case.json"
python3 tool/perf_probe/run_perf_probe_posix.py \
--mode profile --cache-state cold --scenario-set pdf-multi-window --binding-mode framework \
--pdf-case "$PERF_POSIX_ROOT/multi-window-case.json" \
--warmup 0 --repetitions 1 --launches 1 --display-mode desktop \
--hardware-id "$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT-macos-desktop" \
--build-timeout-seconds 1200 --timeout-seconds 600 \
--output "$PERF_POSIX_ROOT/multi-window-run" \
2>&1 | tee "$PERF_POSIX_ROOT/multi-window-run.log"
dart tool/perf_probe/validate_pdf_multi_window.dart \
--root "$PERF_POSIX_ROOT/multi-window-run" \
--platform macos --mode profile --commit "$GITHUB_SHA" \
| tee "$PERF_POSIX_ROOT/verified-native-windows.json"
- name: Preserve POSIX reader measurements and partial failures
if: always() && env.PROBE_PLATFORM == 'macos'
uses: actions/upload-artifact@v7.0.2
with:
name: perf-posix-macos-profile-pdf-reader
if-no-files-found: warn
retention-days: 14
path: |
${{ env.PERF_POSIX_ROOT }}/**/*.json
${{ env.PERF_POSIX_ROOT }}/**/*.jsonl
${{ env.PERF_POSIX_ROOT }}/**/*.csv
${{ env.PERF_POSIX_ROOT }}/**/*.log
${{ env.PERF_POSIX_ROOT }}/**/*.md
${{ env.PERF_POSIX_ROOT }}/**/*.txt
${{ env.PERF_POSIX_ROOT }}/multi-window-run/launch-*/pdf-multi-window-*/*.pdf
${{ env.PERF_POSIX_ROOT }}/multi-window-run/launch-*/pdf-multi-window-*/*.png
!${{ env.PERF_POSIX_ROOT }}/framework-run/data/**
!${{ env.PERF_POSIX_ROOT }}/multi-window-run/data/**
- name: Cleanup only the Simulator created by this job
if: always() && env.PROBE_PLATFORM == 'ios'
shell: bash
run: |
receipt="$RUNNER_TEMP/apple-webview-ios/simulator-id.txt"
if [ -f "$receipt" ]; then
sim="$(cat "$receipt")"
if [[ "$sim" =~ ^[0-9A-Fa-f-]{36}$ ]]; then
xcrun simctl shutdown "$sim" || true
xcrun simctl delete "$sim" || true
else
echo "::error::Refusing cleanup of invalid owned simulator receipt"
exit 1
fi
fi
- name: Preserve full raw and partial evidence
if: always()
uses: actions/upload-artifact@v7.0.2
with:
name: apple-webview-${{ env.PROBE_PLATFORM }}-${{ env.PROBE_MODE }}
if-no-files-found: warn
retention-days: 14
path: |
${{ runner.temp }}/apple-webview-${{ env.PROBE_PLATFORM }}/
${{ env.WEBVIEW_PROBE_REPORTS }}/
${{ runner.temp }}/apple-installed-pdf/
ios-pdf:
name: Actual installed PDF / iOS Simulator / debug
needs: [gate, report-contracts]
if: needs.gate.outputs.run == 'true' && (github.event_name == 'pull_request' || inputs.platform == 'ios')
runs-on: macos-latest
timeout-minutes: 60
env:
CI: 'true'
BOT: 'true'
FLUTTER_SUPPRESS_ANALYTICS: 'true'
DART_SUPPRESS_ANALYTICS: 'true'
CARGO_NET_GIT_FETCH_WITH_CLI: 'true'
CARGO_BUILD_JOBS: '2'
PYTHONUNBUFFERED: '1'
steps:
- uses: actions/checkout@v7.0.1
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.47.9
cache: false
- uses: dtolnay/rust-toolchain@stable
- name: Resolve locked dependencies and verify PDF contracts
shell: bash
run: |
set -euo pipefail
flutter pub get --enforce-lockfile
flutter test --no-pub --concurrency=1 --reporter expanded \
test/tool/perf_probe/installed_plugin_pdf_ios_test.dart \
test/tool/perf_probe/installed_plugin_pdf_macos_test.dart \
test/tool/perf_probe/installed_plugin_pdf_runtime_test.dart test/tool/perf_probe/installed_plugin_pdf_desktop_test.dart test/tool/perf_probe/installed_plugin_memory_pressure_test.dart \
test/tool/perf_probe/installed_plugin_pdf_fixture_test.dart
- name: Run actual PDF app and verify Simulator bundle provenance
timeout-minutes: 45
shell: bash
run: |
set -euo pipefail
python3 tool/perf_probe/run_installed_pdf_ios.py \
--root "$RUNNER_TEMP/installed-pdf-ios" --commit "$GITHUB_SHA"
- name: Cleanup only the PDF Simulator created by this job
if: always()
shell: bash
run: python3 tool/perf_probe/run_installed_pdf_ios.py --root "$RUNNER_TEMP/installed-pdf-ios" --cleanup
- name: Preserve PDF reports, native artifacts and partial failures
if: always()
uses: actions/upload-artifact@v7.0.2
with:
name: installed-pdf-ios-simulator-debug
if-no-files-found: warn
retention-days: 14
path: ${{ runner.temp }}/installed-pdf-ios/