Repository navigation
438 lines (417 loc) · 25.6 KB
/
Copy pathsimulator-qa.yml
File metadata and controls
438 lines (417 loc) · 25.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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
name: Simulator QA evidence
on:
workflow_dispatch:
inputs:
toolchain:
description: Apple SDK to use for the simulator build
type: choice
options: [xcode27, xcode26]
default: xcode27
permissions:
contents: read
concurrency:
group: telegram-ios-simulator-qa-${{ github.ref }}
cancel-in-progress: false
jobs:
capture:
name: First-launch and signed-in screenshots
runs-on: ${{ inputs.toolchain == 'xcode27' && 'xcode-27' || 'macos-26' }}
timeout-minutes: 240
env:
BAZEL_USER_ROOT: /private/var/tmp/_bazel_telegram_ios_qa
BAZEL_CACHE_DIR: ${{ github.workspace }}/.telegram-bazel-qa-cache
BAZEL_REPO_CACHE: /private/var/tmp/telegram-bazel-qa-repo-cache
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: false
- name: Fix submodule URLs for forks
run: |
git config --file=.gitmodules submodule.submodules/rlottie/rlottie.url \
https://github.com/TelegramMessenger/rlottie.git
git config --file=.gitmodules submodule.submodules/TgVoipWebrtc/tgcalls.url \
https://github.com/TelegramMessenger/tgcalls.git
git submodule sync --recursive
- name: Checkout submodules
run: git submodule update --init --recursive --depth 1 --jobs 8
- name: Fetch libxray framework for VLESS support
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
mkdir -p third-party/libxray
if [ ! -d third-party/libxray/LibXray.xcframework ]; then
# The release's download link answered 504 for hours on 2026-11-08 while the API served the same
# asset (id 552003020); the checksum below covers either source.
curl -fsSL --retry 3 --retry-delay 10 --retry-all-errors -o /tmp/libxray-apple-cgo.zip "https://github.com/XTLS/libxray/releases/download/v26.9.9/libxray-apple-cgo.zip" || \
curl -fsSL --retry 5 --retry-delay 10 --retry-all-errors -H "Accept: application/octet-stream" -H "Authorization: Bearer $GH_TOKEN" \
-o /tmp/libxray-apple-cgo.zip "https://api.github.com/repos/XTLS/libxray/releases/assets/552003020"
echo "84a11f0923efb65be7631b3c4cac75bd4351fc13b9cc2394def6af5c1696e9fa /tmp/libxray-apple-cgo.zip" | shasum -a 256 -c -
unzip -q -o /tmp/libxray-apple-cgo.zip -d /tmp/libxray-extract
XCFW="$(find /tmp/libxray-extract -name 'LibXray.xcframework' -type d -print -quit)"
test -n "$XCFW"
mkdir -p third-party/libxray/LibXray.xcframework
cp "$XCFW/Info.plist" third-party/libxray/LibXray.xcframework/
for slice in ios-arm64 ios-arm64-simulator ios-arm64_x86_64-simulator; do
if [ -d "$XCFW/$slice" ]; then
cp -R "$XCFW/$slice" third-party/libxray/LibXray.xcframework/
fi
done
test -d third-party/libxray/LibXray.xcframework/ios-arm64-simulator || \
test -d third-party/libxray/LibXray.xcframework/ios-arm64_x86_64-simulator
fi
- name: Apply vendored tgcalls patch (managed SOCKS5 media routing)
run: |
cd submodules/TgVoipWebrtc/tgcalls
git apply --check ../patches/vless-media-socks.patch
git apply ../patches/vless-media-socks.patch
python3 ../../../Tests/Upstream13/call_patch.py .
- name: Prepare Apple toolchain
uses: ./.github/actions/prepare-apple-toolchain
with:
toolchain: ${{ inputs.toolchain }}
# A cold simulator build filled the runner's disk before the app could be installed ("No space left on
# device", 2026-11-05). The build workflow's cleanup, plus toolchains this job never uses; the Xcode the
# toolchain step selected and the simulator runtimes stay.
- name: Free disk space
run: |
set -euo pipefail
df -h /
sudo rm -rf \
/Users/runner/Library/Developer/CoreSimulator/Caches \
/Users/runner/.cargo \
/Users/runner/.rustup \
/Users/runner/.dotnet \
/usr/local/lib/android \
/Users/runner/Library/Android \
/usr/local/share/powershell || true
SELECTED="$(xcode-select -p | sed -E 's#(/Applications/[^/]+\.app).*#\1#')"
for app in /Applications/Xcode_1*.app /Applications/Xcode_2[0-5]*.app; do
[ -e "$app" ] && [ "$app" != "$SELECTED" ] && sudo rm -rf "$app" || true
done
df -h /
- name: Restore Bazel simulator cache
id: bazel-cache
uses: actions/cache/restore@v4
with:
path: |
${{ env.BAZEL_CACHE_DIR }}
${{ env.BAZEL_REPO_CACHE }}
key: bazel-warm-simulator-${{ inputs.toolchain }}-${{ hashFiles('versions.json', 'MODULE.bazel', 'MODULE.bazel.lock') }}-${{ github.run_id }}
restore-keys: |
bazel-warm-simulator-${{ inputs.toolchain }}-${{ hashFiles('versions.json', 'MODULE.bazel', 'MODULE.bazel.lock') }}-
- name: Build Telegram for iOS Simulator
env:
# Make.py falls back to the GitHub API when Bazel's release link fails (BazelLocation.py).
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
mkdir -p "$BAZEL_CACHE_DIR" "$BAZEL_REPO_CACHE" qa-artifacts
python3 -u build-system/Make/Make.py \
--overrideXcodeVersion \
--bazelUserRoot="$BAZEL_USER_ROOT" \
--cacheDir="$BAZEL_CACHE_DIR" \
build \
--configurationPath=build-system/sideload-configuration.json \
--codesigningInformationPath=build-system/fake-codesigning \
--buildNumber=10000 \
--configuration=debug_sim_arm64 \
--disableExtensions \
2>&1 | tee qa-artifacts/simulator-build.log
- name: Select and boot an iPhone simulator
run: |
set -euo pipefail
# Only a device type the runtime supports boots ("Incompatible device" otherwise), and a runtime may support
# nothing but iPhone Duo (two displays, which `simctl io screenshot` cannot choose between). Take the newest
# iOS runtime that runs a plain numbered iPhone (or its Pro), and the highest-numbered one.
RUNTIMES="$(xcrun simctl list runtimes -j)"
echo "$RUNTIMES" | jq -r '.runtimes[] | select(.isAvailable and (.name | startswith("iOS"))) | "\(.identifier): \([.supportedDeviceTypes[]? | select(.productFamily == "iPhone") | .name] | join(", "))"'
PICK="$(echo "$RUNTIMES" | jq -r '
[.runtimes[] | select(.isAvailable and (.name | startswith("iOS")))
| {runtime: .identifier, version: .version,
devices: [.supportedDeviceTypes[]? | select(.productFamily == "iPhone" and (.name | test("^iPhone [0-9]+( Pro)?$")))]}
| select(.devices | length > 0)]
| sort_by(.version | split(".") | map(tonumber))
| last
| if . == null then empty else "\(.runtime) \(.devices | sort_by(.name | capture("(?<n>[0-9]+)").n | tonumber) | last | .identifier)" end')"
test -n "$PICK"
RUNTIME="${PICK%% *}"
DEVICE_TYPE="${PICK##* }"
echo "Runtime: $RUNTIME"
echo "Device type: $DEVICE_TYPE"
test -n "$DEVICE_TYPE" && test "$DEVICE_TYPE" != "null"
UDID="$(xcrun simctl list devices -j | jq -r --arg runtime "$RUNTIME" --arg type "$DEVICE_TYPE" '(.devices[$runtime] // []) | map(select(.isAvailable and .deviceTypeIdentifier == $type)) | last | .udid // empty')"
if [ -z "$UDID" ]; then
UDID="$(xcrun simctl create Telegram-QA "$DEVICE_TYPE" "$RUNTIME")"
fi
echo "UDID=$UDID" >> "$GITHUB_ENV"
xcrun simctl boot "$UDID"
xcrun simctl bootstatus "$UDID" -b
# The keyboard's one-time "slide to type" sheet otherwise covers the search screen's lower half.
xcrun simctl spawn "$UDID" defaults write com.apple.keyboard.preferences DidShowContinuousPathIntroduction -bool true || true
xcrun simctl spawn "$UDID" defaults write com.apple.Preferences DidShowContinuousPathIntroduction -bool true || true
xcrun simctl status_bar "$UDID" override --time 9:41 --dataNetwork wifi --wifiMode active --wifiBars 3 --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100
- name: Install and capture first-launch screens
run: |
set -euo pipefail
STAGE="$(mktemp -d "$RUNNER_TEMP/liquid-simulator.XXXXXX")"
unzip -q bazel-bin/Telegram/Telegram.ipa -d "$STAGE"
APP="$STAGE/Payload/Telegram.app"
test -x "$APP/Telegram"
{
git rev-parse HEAD
xcodebuild -version
xcrun simctl list runtimes
xcrun simctl list devices -j
} > qa-artifacts/environment.txt
BUNDLE_ID="$(jq -r .bundle_id build-system/sideload-configuration.json)"
echo "Simulator app: $APP"
echo "Bundle id: $BUNDLE_ID"
echo "Runtime: $(xcrun simctl list devices -j | jq -r --arg udid "$UDID" '[.devices[][] | select(.udid == $udid) | .name] | first')"
xcrun simctl install "$UDID" "$APP"
xcrun simctl ui "$UDID" appearance light
xcrun simctl launch "$UDID" "$BUNDLE_ID" --ui-test
sleep 8
xcrun simctl io "$UDID" screenshot qa-artifacts/welcome-light.png
# An app that is already gone was not terminated: it exited on its own (a crash; QA run 32 lost the whole run to
# this on the second launch). Note it, keep going, and let the crash report step below collect the evidence.
xcrun simctl terminate "$UDID" "$BUNDLE_ID" || { echo "::warning::the app exited before the first-launch screenshot was done (light)"; echo "light first launch" >> qa-artifacts/launch-exits.txt; }
xcrun simctl ui "$UDID" appearance dark
xcrun simctl launch "$UDID" "$BUNDLE_ID" --ui-test
sleep 8
xcrun simctl io "$UDID" screenshot qa-artifacts/welcome-dark.png
xcrun simctl terminate "$UDID" "$BUNDLE_ID" || { echo "::warning::the app exited before the first-launch screenshot was done (dark)"; echo "dark first launch" >> qa-artifacts/launch-exits.txt; }
xcrun simctl io "$UDID" recordVideo --codec h264 --force qa-artifacts/first-launch.mp4 &
VIDEO_PID=$!
sleep 2
xcrun simctl launch "$UDID" "$BUNDLE_ID" --ui-test
sleep 15
kill -INT "$VIDEO_PID" || true
wait "$VIDEO_PID" || true
xcrun simctl terminate "$UDID" "$BUNDLE_ID" || true
test -s qa-artifacts/welcome-light.png
test -s qa-artifacts/welcome-dark.png
test -s qa-artifacts/first-launch.mp4
- name: Open an offline fixture account and capture the signed-in screens
run: |
set -euo pipefail
BUNDLE_ID="$(jq -r .bundle_id build-system/sideload-configuration.json)"
mkdir -p qa-artifacts/screens
# Telegram's test servers no longer provision random 99966XYYYY numbers (PHONE_CODE_INVALID on every test
# DC), so the signed-in screens come from an offline fixture: a made-up account with a few chats in the
# --ui-test data directory, networking on a closed loopback proxy (test_createOfflineFixtureAccount).
wait_for_marker() {
local name="$1" seconds="$2"
local data
data="$(xcrun simctl get_app_container "$UDID" "$BUNDLE_ID" data 2>/dev/null || true)"
for i in $(seq 1 "$seconds"); do
if [ -n "$data" ] && [ -f "$data/Documents/$name" ]; then
return 0
fi
if [ $((i % 60)) -eq 0 ]; then
xcrun simctl io "$UDID" screenshot "qa-artifacts/waiting-$name-$i.png" || true
cat "$data/Documents/ui-test.log" 2>/dev/null | tail -5 || true
fi
sleep 1
done
echo "::error::$name did not appear within ${seconds}s"
mkdir -p "qa-artifacts/diagnostics-$name"
xcrun simctl io "$UDID" screenshot "qa-artifacts/diagnostics-$name/screen.png" || true
if [ -n "$data" ]; then
cp "$data/Documents/"*.log "qa-artifacts/diagnostics-$name/" 2>/dev/null || true
fi
# Logger files of the test data directory (app group container).
find "$HOME/Library/Developer/CoreSimulator/Devices/$UDID/data/Containers/Shared/AppGroup" -path '*telegram-ui-tests-data*' -name '*.txt' -mmin -30 -exec cp {} "qa-artifacts/diagnostics-$name/" \; 2>/dev/null || true
cp "$HOME/Library/Logs/DiagnosticReports/"Telegram* "qa-artifacts/diagnostics-$name/" 2>/dev/null || true
xcrun simctl spawn "$UDID" log show --last 15m --style compact --predicate 'process == "Telegram"' 2>&1 | tail -4000 > "qa-artifacts/diagnostics-$name/process.log" || true
ls -la "qa-artifacts/diagnostics-$name" || true
cat "qa-artifacts/diagnostics-$name/ui-test.log" 2>/dev/null || true
return 1
}
xcrun simctl ui "$UDID" appearance light
xcrun simctl launch "$UDID" "$BUNDLE_ID" --ui-test --ui-test-fixture
wait_for_marker ui-test-login.done 180
sleep 2
xcrun simctl terminate "$UDID" "$BUNDLE_ID" || true
# Every screen the offline account can open, through --ui-test-screen: app screens by name, the rest as the
# app's own tg:// links opened in place (url:tg://settings/<path> is a Settings search item id). One launch
# per screen; simctl openurl is not used, it stops at a system confirmation that then covers later screens.
SCREENS=(
"app chats" "app search" "app archive" "app saved" "app compose" "app contacts" "app settings"
"app chat:user:1001" "app chat:user:1002" "app chat:channel:2001" "app chat:channel:2004"
"app url:tg://user?id=1001" "app url:tg://settings/edit" "app url:tg://settings/my-profile"
"app extras" "app extras:appearance" "app extras:ninja" "app extras:ghost" "app extras:privacy"
"app extras:chatList" "app extras:tabBar" "app extras:messages" "app extras:messagesMore" "app extras:sending" "app extras:actions" "app extras:media" "app extras:voice" "app extras:profile" "app extras:profileMore"
"app extras:network" "app archive-settings" "app banana-security" "app accounts"
"app url:tg://settings/appearance" "app url:tg://settings/appearance/themes" "app url:tg://settings/appearance/text-size"
"app url:tg://settings/appearance/message-corners" "app url:tg://settings/appearance/app-icon"
"app url:tg://settings/appearance/stickers-and-emoji" "app url:tg://settings/appearance/wallpapers"
"app url:tg://settings/notifications" "app url:tg://settings/privacy" "app url:tg://settings/privacy/blocked"
"app url:tg://settings/privacy/auto-delete" "app url:tg://settings/privacy/data-settings"
"app url:tg://settings/privacy/active-websites" "app url:tg://settings/data" "app url:tg://settings/data/storage"
"app url:tg://settings/data/usage" "app url:tg://settings/data/proxy" "app url:tg://settings/data/auto-download/mobile"
"app url:tg://settings/data/save-to-photos/chats" "app url:tg://settings/devices" "app url:tg://settings/folders"
"app url:tg://settings/language" "app url:tg://settings/power-saving" "app url:tg://settings/calls"
"app url:tg://settings/premium"
)
# One launch per screen: `capture <appearance> <theme> <target> [language]` saves qa-artifacts/screens/<appearance>-<name>.png
# unless that screenshot already exists. 12 s covers the launch, the 3 s before the screen opens, and its push (8 s left pushed screens mid-animation, or not yet open).
capture() {
local appearance="$1" theme="$2" target="$3" language="${4:-}"
local name
name="$(echo "$target" | sed -E 's#^url:##; s#^tg://##; s#[^A-Za-z0-9]+#-#g; s#-+$##')"
[ -f "qa-artifacts/screens/$appearance-$name.png" ] && return 0
if [ -n "$language" ]; then
xcrun simctl launch "$UDID" "$BUNDLE_ID" --ui-test --ui-test-keep-data --ui-test-theme "$theme" --ui-test-language "$language" --ui-test-screen "$target" ${QA_ARGS:-} > /dev/null
else
xcrun simctl launch "$UDID" "$BUNDLE_ID" --ui-test --ui-test-keep-data --ui-test-theme "$theme" --ui-test-screen "$target" ${QA_ARGS:-} > /dev/null
fi
sleep 12
xcrun simctl io "$UDID" screenshot "qa-artifacts/screens/$appearance-$name.png" > /dev/null 2>&1 || echo "screenshot failed: $appearance-$name"
xcrun simctl terminate "$UDID" "$BUNDLE_ID" || true
}
declare -f capture > "$RUNNER_TEMP/qa-capture.sh"
printf '%s\n' "${SCREENS[@]}" > "$RUNNER_TEMP/qa-screens.txt"
# First the screens under work right now, in English and Russian, uploaded on their own a few minutes in
# (the next step) so they can be looked at long before the full set is done.
PRIORITY=(chats saved chat:user:1001 chat:user:1002 chat:channel:2001 settings extras extras:messages extras:sending
extras:actions extras:messagesMore extras:media extras:voice extras:profile extras:profileMore extras:privacy extras:ninja extras:ghost extras:network
banana-security archive-settings accounts)
xcrun simctl ui "$UDID" appearance light
for target in "${PRIORITY[@]}"; do capture light day "$target"; done
for target in "${PRIORITY[@]}"; do
case "$target" in chat:*|saved|settings) continue ;; esac
capture ru day "$target" ru
done
xcrun simctl ui "$UDID" appearance dark
for target in chats saved chat:user:1001 extras banana-security; do capture dark night "$target"; done
# Extras › Compact Chat List ("compact-") and Compact Message Preview ("compact-preview-"): one line of text per
# row, centred, the badge on that line; also in dark, cream and at the largest text size.
QA_ARGS="--ui-test-compact list"
capture compact-dark night chats
xcrun simctl ui "$UDID" appearance light
for target in chats archive; do capture compact day "$target"; done
capture compact-cream cream chats
xcrun simctl ui "$UDID" content_size accessibility-extra-extra-extra-large || true
capture compact-xl day chats
xcrun simctl ui "$UDID" content_size large || true
QA_ARGS="--ui-test-compact preview"
capture compact-preview day chats
QA_ARGS="--ui-test-compact all"
capture compact-all day chats
QA_ARGS=""
mkdir -p qa-artifacts/app-logs
find "$HOME/Library/Developer/CoreSimulator/Devices/$UDID/data/Containers/Shared/AppGroup" -path '*telegram-ui-tests-data*' -name '*.txt' -exec cp {} qa-artifacts/app-logs/ \; 2>/dev/null || true
ls qa-artifacts/screens | wc -l
- name: Upload the first screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: telegram-ios-simulator-qa-first-${{ github.run_number }}
path: |
qa-artifacts/screens/
qa-artifacts/app-logs/
if-no-files-found: warn
- name: Capture every other screen
run: |
set -euo pipefail
BUNDLE_ID="$(jq -r .bundle_id build-system/sideload-configuration.json)"
source "$RUNNER_TEMP/qa-capture.sh"
SCREENS=()
while IFS= read -r line; do SCREENS+=("$line"); done < "$RUNNER_TEMP/qa-screens.txt"
# The app keeps its own theme (no system switching), so each pass selects one: Classic White, Classic Black
# and the fork's BananaGram Cream.
for appearance in light dark cream; do
case "$appearance" in
light) theme=day; system=light ;;
dark) theme=night; system=dark ;;
cream) theme=cream; system=light ;;
esac
xcrun simctl ui "$UDID" appearance "$system"
for entry in "${SCREENS[@]}"; do
capture "$appearance" "$theme" "${entry#* }"
done
done
# The fork's own screens once more with their Russian strings, which run longer than the English ones and are
# where text overflows first (Telegram's own strings stay English: they need a downloaded language pack).
xcrun simctl ui "$UDID" appearance light
for entry in "${SCREENS[@]}"; do
target="${entry#* }"
case "$target" in
extras*|archive-settings|banana-security|accounts|chats|url:tg://settings/data/proxy) capture ru day "$target" ru ;;
esac
done
# Accessibility passes (Apple HIG: layouts hold at the largest text size and with Increase Contrast). The app
# follows the system text size by default (Text Size: System). The screens a person reads most, plus the fork's
# own pages, where long Russian strings meet large type first; prefixes "xl-" and "contrast-".
A11Y=(chats chat:user:1001 settings extras extras:messages extras:messagesMore extras:privacy extras:profile extras:voice banana-security archive-settings)
xcrun simctl ui "$UDID" content_size accessibility-extra-extra-extra-large || true
for target in "${A11Y[@]}"; do capture xl day "$target"; done
for target in chats extras extras:privacy banana-security; do capture xl-ru day "$target" ru; done
xcrun simctl ui "$UDID" content_size large || true
xcrun simctl ui "$UDID" increase_contrast enabled || true
for target in chats chat:user:1001 extras extras:privacy; do capture contrast day "$target"; done
for target in chats chat:user:1001; do capture contrast-cream cream "$target"; done
xcrun simctl ui "$UDID" increase_contrast disabled || true
ls qa-artifacts/screens | wc -l
# The app's own Logger files, so a screen stuck loading can be read from what the app did.
mkdir -p qa-artifacts/app-logs
find "$HOME/Library/Developer/CoreSimulator/Devices/$UDID/data/Containers/Shared/AppGroup" -path '*telegram-ui-tests-data*' -name '*.txt' -exec cp {} qa-artifacts/app-logs/ \; 2>/dev/null || true
cp "$(xcrun simctl get_app_container "$UDID" "$BUNDLE_ID" data)/Documents/"*.log qa-artifacts/app-logs/ 2>/dev/null || true
ls -la qa-artifacts/app-logs | tail -5 || true
test -s qa-artifacts/screens/light-chats.png
test -s qa-artifacts/screens/dark-chats.png
# Contact sheets: every screen of one appearance on one image, for a quick look.
python3 -m pip install --quiet pillow 2>/dev/null || true
python3 - <<'PY' || true
import glob, os
from PIL import Image, ImageDraw
for appearance in ("light", "dark", "cream"):
files = sorted(glob.glob(f"qa-artifacts/screens/{appearance}-*.png"))
if not files:
continue
thumbs = []
for path in files:
image = Image.open(path).convert("RGB")
scale = 300 / image.width
image = image.resize((300, int(image.height * scale)))
label = Image.new("RGB", (300, 24), (255, 255, 255))
ImageDraw.Draw(label).text((4, 4), os.path.basename(path)[len(appearance) + 1:-4], fill=(0, 0, 0))
tile = Image.new("RGB", (300, image.height + 24), (255, 255, 255))
tile.paste(label, (0, 0)); tile.paste(image, (0, 24))
thumbs.append(tile)
columns = 8
rows = (len(thumbs) + columns - 1) // columns
height = max(t.height for t in thumbs)
sheet = Image.new("RGB", (columns * 300, rows * height), (200, 200, 200))
for index, tile in enumerate(thumbs):
sheet.paste(tile, ((index % columns) * 300, (index // columns) * height))
sheet.save(f"qa-artifacts/contact-sheet-{appearance}.jpg", quality=80)
PY
- name: Save Bazel simulator cache
if: ${{ !cancelled() && steps.bazel-cache.outcome == 'success' }}
uses: actions/cache/save@v4
with:
path: |
${{ env.BAZEL_CACHE_DIR }}
${{ env.BAZEL_REPO_CACHE }}
key: bazel-warm-simulator-${{ inputs.toolchain }}-${{ hashFiles('versions.json', 'MODULE.bazel', 'MODULE.bazel.lock') }}-${{ github.run_id }}
- name: Collect crash reports
if: always()
run: |
# The simulator's crash reports land in the host's DiagnosticReports; the app's own log names the last stage.
mkdir -p qa-artifacts/crash-reports qa-artifacts/app-logs
find "$HOME/Library/Logs/DiagnosticReports" -maxdepth 2 \( -name 'Telegram*' -o -name '*Telegraph*' \) -newer qa-artifacts/environment.txt -exec cp {} qa-artifacts/crash-reports/ \; 2>/dev/null || true
find "$HOME/Library/Developer/CoreSimulator/Devices" -path '*telegram-ui-tests-data*' -name '*.txt' -newer qa-artifacts/environment.txt -exec cp {} qa-artifacts/app-logs/ \; 2>/dev/null || true
ls -la qa-artifacts/crash-reports | tail -5
if [ -s qa-artifacts/launch-exits.txt ]; then echo "::warning::launches that exited on their own: $(tr '\n' ';' < qa-artifacts/launch-exits.txt)"; fi
- name: Upload simulator QA evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: telegram-ios-simulator-qa-${{ github.run_number }}
path: qa-artifacts/
if-no-files-found: warn
retention-days: 14