Skip to content

ci(mobile): stabilize iOS simulator runs on hosted macOS runners - #528

Merged
harryisfish merged 6 commits into
mainfrom
fix/ios-ci-stability
Nov 10, 2026
Merged

harryisfish merged 6 commits into
mainfrom
fix/ios-ci-stability

Conversation

@harryisfish

@harryisfish harryisfish commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

问题

最近 100 次 mobile.yml 中,iOS job 约 75 次只成功 3 次。

  • 每次先花约 35 分钟构建,UI 测试 1.5 到 8 分钟后失败。
  • 驱动层失败集中在三类:app 冷启动后第一次界面快照 90 秒超时;逐字输入长邀请链接文字失真(main 已改粘贴);重装 app 超时。
  • 本分支采样实测:runner 只有 3 核、7 GB 内存。新模拟器开机后约 10 分钟内,负载在 280 到 460 之间,空闲内存约 60 MB,压缩内存约 2.5 GB。最忙的进程是模拟器首启的小组件、新闻、健康、屏幕时间等后台服务,加上 diagnosticd 和 Spotlight。UI 测试正好赶上这段时间。

修改

  • 模拟器 app 按输入缓存。键包含 runner 镜像、rustc 和 Node 版本,以及手机端、共享包(不含文档)、crates、config、根 package.json、pnpm-workspace.yaml、lock 文件和安全库构建脚本的摘要。只有构建后工作树干净才写缓存。命中时跳过安全库和 Xcode 构建,仍核对 entitlements 并上传同样的 zip。
  • 用 simslim v0.14.0(固定发布包,校验 sha256)精简专用模拟器。关闭小组件、Spotlight、Siri、健康、家庭、新闻地图、遥测、邮件日历和信息类服务;保留相册、推送、钥匙串、链接、互联和资源服务。
  • 模拟器改在主机 Rust/网页构建之前创建并开机,剩余启动工作与构建重叠;同时关闭 runner 的 Spotlight 索引。
  • iOS job 超时从 60 分钟改为 90 分钟:缓存未命中时,构建完成就已接近 55 分钟。
  • 新增 scripts/ci-runner-load.sh,从模拟器创建起每 10 秒记录负载、内存、swap 和最忙的 3 个进程名,结束时打印。
  • packages/docs/ci.md 同步说明。

GitHub 目前只提供 macOS 26 镜像,还没有 macos-27。不使用自托管 runner。

与 #472 有重叠:那个 Draft 曾在诊断分支试过 simslim,但从未在 CI 跑过也未合并,自 11-08 起未更新。

验证

  • actionlint 通过;独立审查无 critical,1 个 high(缓存键漏 config/)已修复。
  • 本分支手动触发 mobile.yml(只跑 iOS):
    • 缓存命中,跳过安全库和 Xcode 构建(约 24 分钟)。
    • simslim 在约 90 秒内完成精简开机。
    • 整个 job 负载中位数从 284 降到 54;UI 测试期间 12 到 28;swapouts 从 31204 降到 0。
  • UI 测试已越过以往失败点,现在稳定(3/3)失败在 native-transfers.e2e.ts:540:取消稍后输入后状态没有变为已取消。负载很低,属于功能问题,另开 PR 处理。

负责人:harryisfish。状态:待合并。

@harryisfish harryisfish changed the title ci(mobile): reuse the simulator app by its inputs and sample runner load ci(mobile): stabilize iOS simulator runs on hosted macOS runners Nov 10, 2026
The iOS job spends about 35 minutes building before a UI run that fails
within minutes on a slow simulator. Cache the simulator app keyed by its
inputs, the runner image and the Rust toolchain, and record the runner's
load, memory and busiest processes while the UI test runs.
Runner sampling showed a 3-core, 7 GB host at load 280-460 with ~60 MB
free while the new simulator ran its first-boot widgets, Spotlight and
system daemons during the UI test. Slim the simulator with simslim,
keeping photos, push, keychain, links, connectivity and assets the app
uses, boot it before the host build so remaining startup overlaps the
build, and turn off the runner's own Spotlight indexing.
@harryisfish
harryisfish marked this pull request as ready for review November 10, 2026 12:15
@harryisfish
harryisfish merged commit b7011ae into main Nov 10, 2026
1 of 2 checks passed
@harryisfish
harryisfish deleted the fix/ios-ci-stability branch November 10, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant