持续集成(一)
一、What
持续集成:一种软件开发实践,通过自动化构建(build, ut, deploy)进行验证,以尽快发现集成bug。
Mark:copied from web
二、Why
三、Where
大的Project,周期长的Project,需频繁发布的Project…总之,想要就干。
四、How
a)使用组件
以上组件all are free。Perfect。
b)其他可选组件
c)Configure
首先,手动配置网站ccnet在iis下(有人说安装程序已自动配好,但与本人实际操作不符)。此网站会调用cc.net services。
其次,配置ccnet.config
<cruisecontrol xmlns:cb="urn:ccnet.config.builder"> <!-- This is your CruiseControl.NET Server Configuration file. Add your projects below! --> <project name="TestCC.Net" description="Learning cc.net daily build."> <artifactDirectory>E:\WorkSpace\Projects\TTunit\People\DailyBuild\Artifacts</artifactDirectory> <webURL>http://localhost/ccnet</webURL> <triggers> <!-- check the source control every X time for changes, and run the tasks if changes are found --> <intervalTrigger name="continuous" seconds="1800" buildCondition="IfModificationExists" initialSeconds="30"/> </triggers> <sourcecontrol type="svn" > <trunkUrl>project url</trunkUrl> <workingDirectory>E:\WorkSpace\Projects\TTunit\People</workingDirectory> <executable>D:\installPackage\CruiseControl\SVN\Apache-Subversion-1.7.6\bin\svn.exe</executable> <username>your's user name</username> <password>your's password</password> </sourcecontrol> <tasks> <!--using MsBuild, also could use Nant --> <msbuild> <executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe</executable> <workingDirectory>E:\WorkSpace\Projects\TTunit\People</workingDirectory> <projectFile>Fox.Test.CC.sln</projectFile> <buildArgs>/p:Configuration=Release</buildArgs> <targets>ReBuild</targets> <timeout>900</timeout> <logger>D:\installed\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger> </msbuild> <!--unit test--> <nunit> <path>D:\installed\Nunit2.6\bin\nunit-console.exe</path> <assemblies> <assembly>E:\WorkSpace\Projects\TTunit\People\TestTTT\bin\Release\TestTTT.dll</assembly> </assemblies> <excludedCategories> <excludedCategory>LongRunning</excludedCategory> </excludedCategories> <!--have not works yet --> <outputfile>E:\WorkSpace\Projects\TTunit\People\DailyBuild\UnitTest\nunit-results.xml</outputfile> </nunit> <!--<buildpublisher> <sourceDir>E:\Integration\CI2.0\WorkingDir\Release\2.0\_PublishedWebsites</sourceDir> <publishDir>E:\Integration\CI2.0\Release</publishDir> </buildpublisher> --> <exec executable="E:\WorkSpace\Projects\TTunit\People\DailyBuild\OpenCover.bat" /> <exec executable="E:\WorkSpace\Projects\TTunit\People\DailyBuild\ReportGenerator.bat" /> <!--not free, so i can't get latest version <exec executable="E:\WorkSpace\Projects\TTunit\People\DailyBuild\ncover.bat" />--> <!--FxCop, haven't use yet--> <!--exec executable="D:\\fxcop.bat" --> <!--in order to see reports in cc.net website--> <merge> <files> <!--not sure what effect it takes--> <file>E:\WorkSpace\Projects\TTunit\People\DailyBuild\UnitTest\OpenCover\openCoverTest.xml</file> <!-- Other files to merge for your build would also be included here --> </files> </merge> </tasks> <publishers> <statistics /> <xmllogger /> <email mailport="25" includeDetails="TRUE" mailhostUsername="userName" mailhostPassword="password" useSSL="FALSE"> <from>sender</from> <mailhost>mail host</mailhost> <users> <user name="dave" group="developers" address="[email protected]***.com" /> <user name="charlie" group="buildMaster" address="[email protected]***.com" /> </users> <groups> <group name="developers"> <notifications> <notificationType>Failed</notificationType> <notificationType>Fixed</notificationType> </notifications> </group> <group name="buildMaster"> <notifications> <notificationType>Always</notificationType> </notifications> </group> </groups> <converters> <regexConverter find="$" replace="@foxglobal.com" /> </converters> <!--mail subject used on fail sititute--> <subjectSettings> <subject buildResult="StillBroken" value="Build is still broken for TestCC.Net" /> </subjectSettings> </email> </publishers> <externalLinks> <externalLink name="OpenConver" url="http://localhost/OpenCover/index.htm" /> </externalLinks> </project> </cruisecontrol>
配置完成后,应该先使用CCValidator.exe验证config文件是否合格。
再次,配置dashboard.config,in order to merge other reports in cc.net website.Corresponding xsl file are in their installed folder
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
<xslFile>xsl\tests.xsl</xslFile>
<xslFile>xsl\timing.xsl</xslFile>
<xslFile>xsl\OpenCoverSummary.xsl</xslFile>
<xslFile>xsl\OpenCoverClass.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
<xslReportBuildPlugin description="NUnit Details" actionName="NUnitDetailsBuildReport" xslFileName="xsl\tests.xsl" />
<xslReportBuildPlugin description="NUnit Timings" actionName="NUnitTimingsBuildReport" xslFileName="xsl\timing.xsl" />
<!-- Add the following to replace the legacy NCover xsl with the NCoverExplorer summary -->
<!--<xslReportBuildPlugin description="OpenCover Report" actionName="OpenCoverBuildReport" xslFileName="xsl\OpenCoverSummary.xsl" />
<xslReportBuildPlugin description="OpenCover Class Report" actionName="OpenCoverBuildClassReport" xslFileName="xsl\OpenCoverClass.xsl" />-->
</buildPlugins>
最后,Start cc.net services, and then browser cc.net website, force it.
d)Exception in learning progress
1)SVN证书验证失败
命令行工具checkout repository,选中 (p)ermanently。若在域中,需对ccnet services的登录账号设置为域账号。
2)Ncover exception: no data collected
版本问题。Ncover 3.1不支持.net 4.0。
3)SVN operation failed:please see the ‘svn upgrade’ command
由于workspace是使用tortoise checkout的,版本比VisualSVN低。所以upgrade吧。
五、Result
View Cover report through external link
Summary:
持续集成(二) will include "auto deploy", fxCop...
转载于:https://www.cnblogs.com/zzq417/archive/2012/08/31/agile_ccnet1.html