简体   繁体   English

持续集成构建配置

[英]Continuous Integration Build Configurations

I have been charged with setting up a CI server in my company and I am looking for some advise on what build configs i need for my projects. 我被指控在我公司设置CI服务器,我正在寻找一些关于我的项目需要什么构建配置的建议。 As a first step i have set up the builds as: 作为第一步,我将构建设置为:

Commit Build: Compiles code and runs unit tests 提交构建:编译代码并运行单元测试
Integration Build: Compiles code and runs long running integration tests 集成构建:编译代码并运行长时间运行的集成测试

I am unsure what else i would need to complete the CI picture. 我不确定我还需要什么来完成CI图片。 For example What build configs do you have in your shop? 例如,你的商店里有什么构建配置?

I know there must be a step for deploying my successful builds, but would l make the deployment part of Integration? 我知道必须有一个步骤来部署我的成功构建,但是我会将部署作为Integration的一部分吗?

Using TeamCity, MSBsuild and SVN 使用TeamCity,MSBsuild和SVN

Looking for much needed advice. 寻找急需的建议。

The most complete build I ever saw did the following things in the given order. 我见过的最完整的构建按给定顺序执行了以下操作。 There are two groups, all targets in each group are executed regardless of failure, but the group fails if a member of the group fails. 有两个组,无论失败如何,每个组中的所有目标都会执行,但如果组成员失败,则组将失败。 So we see ALL problems. 所以我们看到了所有问题。

First group working on sources: 第一组工作来源:

  • clean work directory 干净的工作目录
  • update to newest sources, get everything from SVN 更新到最新的来源,从SVN获取一切
  • compile sources, rmic etc. 编译来源,rmic等
  • valudate XML resources (as at least in Java there were a lot, like deployment descriptors, stylesheets etc.) valudate XML资源(至少在Java中有很多,比如部署描述符,样式表等)
  • do static code analysis available for sources, eg checking whitespace, coding conventions namings, file names, or more sophisticated checks done on the AST of the source (like PMD does it for Java). 为源提供静态代码分析,例如检查空格,编码约定,命名,文件名,或者对源的AST进行更复杂的检查(就像PMD为Java做的那样)。
  • check naming conventions of other files, eg we checked the names of all dependant libraries to contain a version number. 检查其他文件的命名约定,例如,我们检查了所有依赖库的名称以包含版本号。

Second group is working on the produced code, only if the first step succeeded: 第二组正在处理生成的代码,只有第一步成功:

  • run the unit tests 进行单元测试
  • run fast integration tests 运行快速集成测试
  • do static code analysis available for sources (most tools for Java do it this way), eg checking for typical bug patterns (like Findbugs does it for Java) 为源提供静态代码分析(Java的大多数工具都是这样做的),例如检查典型的bug模式(比如Findbugs为Java做的)
  • do reference checking, eg enforce layering of architecture, allowance of usage of certain classes from other classes etc. 进行参考检查,例如强制执行体系结构分层,允许从其他类中使用某些类等。
  • create the full deployment package 创建完整的部署包

This is the main build that is triggered time after time for commits. 这是提交一次又一次触发的主要构建。 It did a lot, but with some powerfull machine using several cores it was around 4 mins for 500k LOC. 它做了很多,但有一些强大的机器使用几个核心,它约为4分钟500k LOC。 Testers can get the newest snapshot builds if they like to. 如果他们愿意,测试人员可以获得最新的快照构建。

Long running integration tests (2 hours each) would run once per night and only do 长时间运行的集成测试(每个2小时)将每晚运行一次并且仅运行

  • compile
  • run long running tests 运行长时间运行测试

Another build was a purely documantion build, triggered once per night. 另一个版本是纯粹的文档构建,每晚触发一次。 It would never fail. 它永远不会失败。

  • create API documentation 创建API文档
  • do a full static code analysis with all rules and produce some kind of indicator for the overall project quality 使用所有规则进行完整的静态代码分析,并为整体项目质量生成某种指标
  • produce coverage reports (it's a pity we did not enforce coverage to grow) from all projects build before 从以前构建的所有项目中生成覆盖率报告(遗憾的是,我们没有强制实施覆盖范围)
  • produce all kind of fancy documentation like Maven site or Sonar report etc. This is for management/QA most of the time. 制作各种花哨的文档,如Maven网站或Sonar报告等。这是管理/ QA的大部分时间。

Things that we run in a previous project on each CI run where Code Coverage Records, publish the automated generated documentation and Checkstyle reports. 我们在每个CI运行的先前项目中运行的事项,其中代码覆盖率记录,发布自动生成的文档和Checkstyle报告。

This gave us some stats about the statistical quality of each checkin for planing and improving our work habits. 这给了我们一些关于每个登记计划的统计质量的统计数据,以及改善我们的工作习惯。

We have build configurations for 我们已经构建了配置

  • compile + unit tests + static analysis (findbugs in our case) + code coverage (triggered on commit) 编译+单元测试+静态分析(在我们的例子中是findbugs)+代码覆盖率(在提交时触发)
  • integration tests (triggered on a schedule as long as there is a commit) 集成测试(只要有提交就按计划触发)
  • deployment to test (manually triggered) 部署测试(手动触发)

The deployment configuration allows a non-technical QA resource to deploy to the test environment whenever they're ready to test something, and avoids the confusion of whether a bug fix has hit the test environment yet. 部署配置允许非技术QA资源在他们准备测试某些内容时部署到测试环境,并避免混淆错误修复是否已经到达测试环境。

We had a similar conversation at the most recent CITCON North America (Continuous Integration and Testing conference) where we all shared our experiences and tried to put together a road map from simple CI to very built out CI and release systems. 我们在最近的CITCON北美(持续集成和测试会议)上进行了类似的对话,我们在这里分享了我们的经验,并尝试将简单CI的路线图组合到非常内置的CI和发布系统中。

The original conference notes are here . 原始会议记录在这里 Along with a Flickr photostream . 随着一个Flickr 照片流 A cleaned up version is available at the urbancode blog as well. 城市代码博客也提供清理版本

The Aussies revisited the topic at CITCON Brisbane and a pencast of that is available 澳大利亚人在CITCON布里斯班重新审视了这个主题,并提供了一个可用的Pencast

Hope some of those resources are useful. 希望其中一些资源是有用的。

I am working on this at the moment. 我正在研究这个问题。 Our build configuration does the following: 我们的构建配置执行以下操作:

Build: 建立:

  • Compile. 编译。
  • Test. 测试。
  • Merge different environment specific configuration values with a base config (this leaves us with Staging.config, Test.config etc) 使用基本配置合并不同的特定于环境的配置值(这使我们得到Staging.config,Test.config等)
  • Create a file called VERSION.txt that lists build times, revision numbers etc. 创建一个名为VERSION.txt的文件,列出构建时间,修订号等。
  • Publish all of this to a clean directory. 将所有这些发布到一个干净的目录。 That is then picked up as a build artifact by teamcity. 然后由teamcity将其作为构建工件。

Now we have an application that can be published to any server simply by copying it to the deployment directory, and renaming the appropriate config file to web.config 现在我们有一个可以发布到任何服务器的应用程序,只需将其复制到部署目录,并将相应的配置文件重命名为web.config

We then have 3 more configurations for deployment. 然后我们有3个配置进行部署。 The first gets deployed to a development environment after every successful build. 每次成功构建后,第一个都会部署到开发环境中。 This gives us a working version of the latest codebase at all times. 这为我们提供了最新代码库的工作版本。 The second gets deployed to staging manually. 第二个部署到手动分段。 This is set to deploy from the last pinned development build. 这将设置为从上一个固定的开发版本进行部署。 Finally there is a live deployment configuration then deploys from the last deployed staging build. 最后,有一个实时部署配置,然后从上次部署的暂存构建进行部署。 This does a number of extra things: 这会做一些额外的事情:

  • Tag the released version 标记发布的版本
  • Create an archive of it an place it in a directory for save keeping 创建一个存档,将其放在目录中以便保存
  • Go over all checkin comments since the last live build and extract ones with ticket numbers. 查看自上次实时构建以来的所有签到注释,并使用票号提取。 Then use the titles of the tickets to generate a preliminary change list. 然后使用故障单的标题生成初步更改列表。 This is edited by the PM before being saved for posterity. 这是由PM编辑的,然后保存给子孙后代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM