Repository navigation
perf(ci): 缩短检查关键路径并优化构建缓存与超时 - #1412
Merged
Merged
Conversation
This was referenced Nov 8, 2026
16 of 20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
缩短 CI 的串行关键路径,并为下载、测试和打包增加可定位的超时边界。历史样本中浏览器串行检查耗时 923 秒,Windows 最低 Rust 版本检查额外串行占用 347–425 秒;完整证据见 CI 触发与缓存策略。
修复 / 新增 / 改进
tauri bundle生成 MSI,复用二进制;TypeScript 启用本地增量检查。诊断构件保留 7 天,安装包保留 14 天。兼容
保留现有平台/架构覆盖、变更范围门控、发布优化等级及签名流程。历史标签修复继续使用原有 setup-node 缓存,避免依赖旧标签中不存在的本地 action。
并行拆分增加 runner 数,实际收益取决于排队和缓存;新缓存键首次需要预热。MSI 实际打包及 macOS 签名仍需平台验证。
测试计划
npm test:构建和全部 166 个测试文件通过;最后的历史标签缓存兼容修正已重跑相关发布/并发行为测试。git diff --check通过。playwright test --list --project=…,各发现 116 个测试。首轮远端实测
对照是本 PR 父提交
c002b56c的完整 CI 42232769516;本轮为33785acb的 CI 42490834011。GitHub 页面总时长约从45分19秒变为14分32秒,但首个作业启动前的等待从24分03秒变为3秒;上表的31.9%已排除这段差异,不把排队减少当作优化收益。执行窗口仍包含后续作业间的调度等待。
这是一次历史同基线对照,尚非受控重复 A/B。本轮 Windows stable/MSRV 的 Rust 缓存均未命中,两种浏览器也进行了新缓存键的首次下载;对照 Windows stable 命中缓存。macOS 两项均命中原缓存,但主检查从5分54秒变为8分18秒,MSRV从3分47秒变为5分13秒。因此本轮证实了等待时间缩短,总 runner 用量尚未下降;合并并建立 beta 新缓存后的稳定收益仍需再次测量。Windows/macOS 发布打包速度未包含在这轮 CI 实测中。
第二轮:复用重复 Rust 编译
cargo check改为cargo build --profile test --lib --bins,复用前一步测试编译的依赖,同时继续编译、链接非测试生产路径。提交
e4237527的 完整 CI,attempt 1 全部通过:16 个作业成功、发布作业按预期跳过,Chromium/WebKit 共 232 个测试通过,macOS 完成全部 166 个前端/契约测试文件。新增复用测试已修复 macOS 临时目录/var→/private/var的路径别名问题,并验证了符号链接目录用例。第二轮整轮没有继续提速,执行窗口增加19.2%;runner合计减少5.9%。原始21分14秒基线到本轮17分15秒缩短18.8%,但各轮均为单次历史/在线样本,不能将全部差异归因于改动。
日志显示诊断步骤从285条
Compiling+ 244条Checking减为仅1条主应用Compiling;backend 的Compiling从295条减为153条,复用实际发生。与此同时,未修改的主应用测试编译处理相同529个包、均为冷缓存,却从287秒增至476秒;未修改的 runtime lifecycle 从72秒增至110秒、recorder从39秒增至67秒。本轮 Windows 的多个阶段存在明显耗时波动。同一提交的 Windows 单 job 复跑,attempt 2 也已通过,其他作业沿用原通过结果。Windows stable 为15分23秒,主应用编译400秒、诊断60秒、backend99秒;Rust仍为冷缓存,编译条目分别为529、1、153,与第一次相同。
可以确认诊断步骤从194秒降到60–66秒,缩短约66%–69%;backend重复编译条目减少48.1%,但耗时99–122秒对比原101秒,尚未证明稳定提速。第二轮没有证实整轮继续加速:两次Windows stable为16分56秒、15分23秒,都高于首轮13分36秒。保留全部样本,不用单job复跑推算新的整轮CI时间。
后续优先测量beta预热后的Rust缓存,并对Windows编译并行度做受控对照;若继续压低整体关键路径,还需同时处理WebKit、Linux测试和MSRV约9–10分钟的作业。正式Windows/macOS发布打包仍未包含在这些远端计时中。