提高CI编译时间(.NET) [英] Improving CI build time (.NET)

查看:313
本文介绍了提高CI编译时间(.NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发使用的TeamCity作为CI服务器一个应用程序框架+插件。

We are developing an application framework + "plugins" using TeamCity as a CI server.


  1. 4 Visual Studio的解决方案

  2. 〜70项目(和提高)

  3. 目前运行2建立使用的TeamCity。CI和鼎力打造

CI 的 - 触发每次提交

CI - triggered on every commit.

FULL 的 - 在夜间运行

我想提高双方建立的性能(尤其是CI的身材,因为它需要尽快给它的输出)。

I would like to improve the performance of both builds (especially the CI build, as it needs to give its output as quickly as possible).

有没有什么可以有效地和容易地改进一般指南?

Are there any guidelines in general on what can be effectively and easily improved?

在生成过程只是建立一个.sln文件并运行一些单元测试。

The build process simply builds a .sln file and runs some unit tests.


  • MSBuild的并行

  • 重写CopyFilesToLocal

不知道这些都是适用/会导致性能提升。

Not sure these are applicable/will result in a performance gain.

我要寻找更多的途径来提高构建时间(这大约需要3-4分钟)。

I am looking for more ways to improve the build time (which takes around 3-4 minutes).

推荐答案

尽量减少你的CI构建做的工作。

Minimise the work your ci builds do.


  • 设置了隐形不需要的文件夹中的工作区,以减少你需要从源代码管理获取的文件数量。如果有必要重新组织你的源结构,这样很容易磕数据的整个文件夹进行构建与伪装。

  • set up the workspace with any unneeded folders cloaked, to minimise the number of files you need to get from source control. If necessary reorganise your source structure so that it's easy to knock whole folders of data out of the build with cloaking.

确保CI构建使用增量get和增量生成。

make sure the ci build uses incremental get and incremental build.

只有构建解决方案/你需要的项目。如果你的库只得到很少改变,你能precompile和检查二进制文件到源代码控制?如果一个项目是不是目前正在积极地开发,不要打扰在CI构建它的基础之上。

only build solutions/projects that you need to. If your libraries only get changed infrequently, can you precompile them and check the binaries into source control? If a project is not currently being actively developed, don't bother building it in ci builds.

你需要为每个检查运行单元测试?我们运行$一个简单的词编译C $ C只,有独立的测试版本运行的词,但不超过每小时一次的频率更高。这斜杠我们的CI编译时间,但仍然可以让我们知道在一个小时内,如果我们打破任何的单元测试。

do you need to run unit tests for every check in? We run a simple ci build of code only, with a separate test build running as ci, but no more frequently than once per hour. This slashes our ci build time but still lets us know within one hour if we break any unit tests.

同样地,不建文档,混淆视听,建设安装,签订证书等组件,并禁用输出复制到投递文件夹的构建过程。 CI构建有没有告诉你,如果你已经打破了构建尽快,你不关心生成有用的二进制输出。

Similarly, don't build documentation, obfuscate, build installers, sign assemblies with certificates, etc, and disable any build processes that copy the outputs to the drop folder. CI builds are there to tell you if you've broken the build asap, you don't care about generating useful binary outputs.

在一般的优化版本 - 合并项目一起,使用多线程构建,使用多种生成代理使CI构建不必等待其他构建类型来完成。只有这样做构建服务器专用,而你正在努力CI完全建立过夜。保留源文件整齐(删除未使用的code,而不只是评论它,删除未使用的usings /包括等)

optimise the build in general - merge projects together, use multi-threaded builds, use several build agents so ci builds don't have to wait for other build types to complete. Only do full builds overnight so your build server is dedicated to ci while you are working. Keep source files tidy (delete unused code rather than just commenting it out, remove unused usings/includes etc.)

投资于更好地建设服务器硬件。如果你没有一个顶级规格的机器,下降更多的内存和SSD到它一个便宜的速度提升。确保您的构建服务器是专门为CI构建,并且不被用于其他任何可能慢下来。确保构建服务器和TFS SEVER之间的网络是千兆。确保你没有在服务器上运行任何防病毒软件,或者至少是其计划的扫描在夜间运行和构建文件夹中的实时扫描排除清单。

invest in better build server hardware. If you don't have a top spec machine, drop more RAM and an SSD into it for a cheap speed boost. Make sure your build server is dedicated to ci builds, and isn't being used for anything else that might slow it down. Make sure the network between the build server and tfs sever is gigabit. Ensure you don't have any anti-virus software running on the server, or at least that its scheduled-scans are run overnight and your build folders are in the real-time-scan exclusion lists.

使用TFS政策检查停止开发者在检查如果CI构建失败,让你停下来立即修复破损。

use tfs check in policies to stop devs checking in if the ci build has failed, so that you stop and fix breakages immediately.

这篇关于提高CI编译时间(.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆