ci: 用独立 runner 与任务缓存缩短 PR 等待 - #139
Merged
Merged
Conversation
把类型检查、两组测试和产物验证分配到独立 runner,避免全部堆在 verify 的关键路径,同时保留每台 runner 单个 Vitest pool。用统一 verify 汇总全部结果,失败、取消或跳过均拒绝通过。只缓存类型检查和构建,根脚本与工具链变化使缓存失效;测试及 tarball 检查每次执行。代价是增加并行 runner 与依赖安装次数。
Disdjj
marked this pull request as ready for review
September 5, 2026 23:36
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.
最近 20 次成功 PR CI 的中位数为 6 分 16 秒、p90 为 6 分 50 秒。最近一次纯文档 PR 仍等待 6 分 32 秒:类型检查 107 秒、lint 30 秒、测试 149 秒、构建 67 秒串行堆叠;依赖安装仅 8 秒,正常排队中位数仅 3 秒。基线运行
将 quality、单测、集成测试与 build/pack 放到独立 runner。每台测试 runner 仍限制一个包的 Vitest pool,保留此前修复 DOM 计时器超时的约束;测试直接消费源码,类型检查由独立任务承担,避免每台 runner 重复执行。所有包测试及根目录的发布、Dockerfile、部署过滤、Compose 快照回归完整保留。
仅类型检查与构建使用跨运行 Turbo 缓存,按 Node 精确版本、OS/架构、任务、锁文件、根配置和根脚本隔离,包源码及依赖由 Turbo task hash 判断。测试和最终 tarball 检查每次执行。统一 verify 检查保留,并显式拒绝任何依赖任务的失败、取消或意外跳过。
取舍是增加并行 runner 和几次依赖安装,以缩短 PR 等待。没有公开包的契约或发布内容变化,无需 bump 或发布 tag。
验证:
统计口径为本次 attempt 创建到最后 job 完成。两次新运行均使用同一提交,每种缓存状态各测一次;这证明本次收益,不能替代长期 p50/p90。冷缓存 typecheck 0/8、build 0/6 命中;热缓存分别 8/8、6/6 命中,实际执行步骤均降至约 1 秒。热缓存两组测试仍实际运行 80 秒与 66 秒,tarball 检查仍执行 11 秒。
累计 runner 执行时间由基线 395 秒变为冷缓存 441 秒(约 +12%)、热缓存 296 秒(约 -25%);这是执行时长,未计账单按 job 取整。主干首次运行后才能建立供后续 PR 复用的 main 分支缓存。