Kun Chen 谈智能体时代如何优化 CI 瓶颈
Worth a read 🤝
Kun Chen 认为,在大家都不再逐行审查代码后,CI 成了新的瓶颈;按智能体速度,若 CI 仍只是跑全部构建、lint 和测试,会严重拖慢节奏。他给出三条优化建议:在 CI 与 CD 之间平衡负载、让代码库模块化以只测被改动的模块、对大模块投入测试选择(他称某大型代码库 CI 因此快 20 倍且几乎不漏问题)。Larsen Cundric 转发并称值得一读。
查看原帖既然我们都同意不再审查大部分代码,CI 就成了下一个瓶颈 在智能体的速度下,如果我们的 CI 流水线只是“运行所有构建、lint、测试”,它就会成为严重的拖慢因素 以下是我对如何优化提出的几点建议: 1. 在 CI 与 CD 之间平衡负载 CI 保护主分支。CD 保护生产环境。如果你能容忍主分支部署到生产环境有一定延迟,那么你可以在 CI 里少做一些,在 CD 里多做一些 例如,对于一个跨平台应用,我让 CI 流水线跳过大部分 mac 和 windows 测试,因为 linux 已经覆盖了相同的功能 tradeoff 是偶尔我会在发布前的 CD 中捕获到仅限 mac 或 windows 的 bug,但作为交换,我的 CI 流水线快了 15 倍——非常值得 2. 将代码库模块化,使改动相互隔离 这样你就可以让 CI 只对受影响的模块运行构建、lint、测试 这需要仔细考虑跨模块协议。它们很可能应该作为独立模块,这样当它们发生变更时,你就知道可能需要测试所有依赖模块 3. 对于大型模块,投入测试选择 在 CI 中,尽量只运行覆盖被改动区域的测试。不过做准确的测试选择并不容易,而且往往需要持续调优 我有一个 nightly 循环,专门审计过去的测试运行,并调整我的测试选择使其更准确。我的一个大型代码库在这方面做得相当好——与运行所有测试相比,CI 快了 20 倍,而且几乎从不漏掉任何真正的问题
查看原文
now that we all agreed to not review most of the code any more, CI became the next bottleneck at agent speed, if our CI pipeline is simply "run all the build, lint, tests", it'll become a major slow down here are a few things i suggest for how to optimize: 1. balance load between CI and CD CI protects main branch. CD protects production. if you can tolerate some delay in deploying your main branch to production, then you can do less in CI and do more in CD for example, for a cross platform app i made my CI pipeline skip most mac and windows tests because linux already covered the same functionality the tradeoff is occasionally i'd catch a mac or windows-only bug in CD before release, but in exchange, my CI pipeline became 15x faster - well worth it 2. modularize your codebase such that changes are isolated then you can make your CI only run build, lint, test for the module being touched this requires careful consideration for cross-module protocols. they should likely be their own modules, so when they do change, you know you probably need to test all dependent modules 3. for large modules, invest in test selection in CI, try to only run tests that are covering the areas being changed. doing accurate test selection is not easy though, and often requires continuous tuning i have a nightly loop specifically doing audit of past test runs and tweak my test selection to be more accurate. a big codebase of mine got pretty good at this - 20x faster CI compared to running all tests, and almost never miss any real problem
正文 · AI 翻译
值得一读 🤝