研发模式:Monorepo
从Multirepo到Monorepo 袋鼠云数栈前端研发效率提升探索之路
前端代码管理一直是困扰不少前端开发团队的难题,从开发到发布的整体工作流程中,除了常规的技术问题外,往往还伴随着沟通成本、维护成本及协作效率等问题。这些问题在团队规模较小的时候可能不太明显,但是当团队规模变大时矛盾就越发凸显。
数栈前端开发团队负责着离线开发、实时开发、数据服务、数据资产等多条产品线的开发和维护工作,面对众多的产品线,如何合理的管理代码,成了团队需要思考的问题,虽然借助了Multirepo进行管理,但还是遇到了许多难题。
How We Halved Go Monorepo CI Build Time
Before 2021, Uber engineers would have to take quite a taxing journey to make a code change to the Go Monorepo. First, the engineer would make their changes on a local branch and put up a code revision to our internal code review system, Phabricator. Next, our infrastructure would see the request and initiate a number of validation jobs on our CI. Those jobs would run build and test validation using the Bazel™ build system, check the coverage, do some other work, and report back to the user a red light (i.e., tests failed or some other issues) or green light. Next, the user, after seeing the “green light,” would get their code reviewed and then initiate a “land” request to the Submit Queue. The queue, after receiving their request, would patch their changes on the latest HEAD of the main branch and re-run these associated builds and tests to make sure their change would be valid at the current state of the repository. If everything looked good, the changes would be pushed and the revision would be closed.
This sounds pretty easy, right? Make sure everything is green, reviewed, and then let the queue do the work to push your change!
Well… what if the change is to a fundamental and widely used library? All packages depending on the library will need to be validated, even though the change itself is only a few lines of code. This might slow down the “build and test” part. Validating this change could sometimes take several hours. Internally, we call such changes big changes.
基于 Bazel 的 iOS Monorepo 工程实践
目前B站客户端的 Monorepo 模式还在进化中,未来会有越来越多的编译优化的自研规则实装到我们的iOS项目中来,分布式编译能力也已经提上日程。
从 Turborepo 看 Monorepo 工具的任务编排能力
Turborepo 是一个用于 JavaScript 和 TypeScript 代码库的高性能构建系统。通过增量构建、智能远程缓存和优化的任务调度,Turborepo 可以将构建速度提高 85% 或更多,使各种规模的团队都能够维护一个快速有效的构建系统,该系统可以随着代码库和团队的成长而扩展。
基于 Yarn 的 Monorepo 实践
最近我用 Yarn 包管理工具实践了一次 Monorepo 的工程化搭建,此文意在将实践过程分享出来并说说我对 Monorepo 的一些看法,仅供参考。
Monorepo——探秘源码管理新姿势!
Monorepo是一个“单仓多包”的代码管理策略,由于众多大型厂商和开源项目在其上的实践,Monorepo受到了越来越多的关注,和其他已有的代码库管理方案相比,有着自身独特的优势。本文仅讨论Monorepo在前端开发场景中的应用及实践,里面提到的概念和示例都会有所局限,可依据实际情况自行扩展阅读其他资料。