每日集成CruiseControl.NET + SVN + Msbuild + NAnt

CruiseControl.NET-1.8.4.0-Setup.exe              是服务器,安装时可以选择生成windows service以便开启,建议测试时不用windows service,直接用CruiseControl.NET 的运行文件,这样配置有问题时可以直接在上面看的到错误原因                    
CruiseControl.NET-CCTray-1.8.2.0-Setup.exe  是客户端,在配置好了CruiseControl.NET\server\ccnet.config以后,可以setting中增加需要管理的project
VisualSVN-Server-2.7.2.msi            ccnet.config中的会用到,提取svn
NAnt                                                            可以用来build project,拷贝文件等等...,

 

 ccnet.config

  1 <cruisecontrol xmlns:cb="urn:ccnet.config.builder">

  2   <!-- This is your CruiseControl.NET Server Configuration file. 

  3        Add your projects below! -->

  4 

  5   <!--可以有多个,但是name需要唯一-->

  6   <project name="WorkDemo">

  7 

  8     <!--集成报告的URL-->

  9     <webURL>http://127.0.0.1/ccnet</webURL>

 10 

 11     <!--集成的日志,对这个项目的监控过程的日志记录目录, 需要确保文件夹路径存在-->

 12     <artifactDirectory>C:\CCNet\WorkDemo\Log</artifactDirectory>

 13 

 14     <!--源码修改后延迟多少秒执行集成-->

 15     <modificationDelaySeconds>10</modificationDelaySeconds>

 16 

 17     <!--每次编译标记-->

 18     <!--Date Labeller   生成如下格式yyyy.mm.dd.build-->

 19     <labeller type="dateLabeller" />

 20     <!--Default Labeller    在指定的前缀后顺序加一,incrementOnFailure设为true指只有成功时才加一-->

 21     <!--<labeller type="defaultlabeller">

 22       <prefix>Foo-1-</prefix>

 23       <incrementOnFailure>true</incrementOnFailure>

 24     </labeller>-->

 25     <!--按迭代命名    duration几周一次迭代,releaseStartDate迭代开始时间-->

 26     <!--<labeller type="iterationlabeller">

 27       <prefix>1.2</prefix>

 28       <duration>1</duration>

 29       <releaseStartDate>2005/6/24</releaseStartDate>

 30       <separator>_</separator>

 31     </labeller>-->

 32     <!--Last Change Labeller  一些有changenumber源码管理器用的-->

 33     <!--<labeller type="lastChangeLabeller">

 34       <prefix>Foo-1-</prefix>

 35     </labeller>-->

 36 

 37     <!--引起集成编译的触发器-->

 38     <triggers>

 39       <!--name: trigger的名字,可以随便起,

 40       seconds: 两次集成的时间间隔

 41       buildCondition: IfModificationExists,只有源码有修改才运行  —— 好像没填这个就是默认

 42       ForceBuild,不管有无修改都运行-->

 43       <intervalTrigger name="intervalTrigger1" initialSeconds="0" seconds="60" buildCondition="IfModificationExists"/>

 44 

 45 

 46       <!--time:什么时间执行,buildCondition同上, weekDays是和集合Monday-Sunday,哪天执行。-->

 47       <!--<scheduleTrigger time="23:30" buildCondition="ForceBuild">

 48         <weekDays>

 49           <weekDay>Monday</weekDay>

 50         </weekDays>

 51       </scheduleTrigger>-->

 52 

 53       <!--什么时间,什么类型的Trigger不执行-->

 54       <!--<filterTrigger startTime="23:30" endTime="23:45">

 55         <trigger type="intervalTrigger" seconds="60" />

 56         <weekDays>

 57           <weekDay>Sunday</weekDay>

 58         </weekDays>

 59       </filterTrigger>-->

 60 

 61       <!--多个Trigger,operator如果是And那么任何一个Trigger没有执行,集成都不执行。

 62           可选值是And 和Or-->

 63       <!--<multiTrigger operator="And">

 64         <triggers>

 65           <intervalTrigger />

 66           <filteredTrigger startTime="23:30" endTime="23:45" />

 67         </triggers>

 68       </multiTrigger>-->

 69 

 70       <!--由别的项目引起集成-->

 71       <!--<projectTrigger serverUri="tcp://server:21234/CruiseManager.rem" project="Server">

 72         <triggerStatus>Success</triggerStatus>

 73         <innerTrigger type="intervalTrigger" seconds="30" buildCondition="ForceBuild"/>

 74       </projectTrigger>-->

 75       

 76       <!--triggerStatus:引起集成的条件,可能的值有 Success, Failure, Exception and Unknown 6. Url Trigger

 77       有制定的Url文件修改引起的集成,buildCondition可设为默认IfModificationExists-->

 78       <!--<urlTrigger url="http://server/page.html" seconds="30" buildCondition="ForceBuild"/>-->

 79     </triggers>

 80 

 81     <!--源码控制器配置-->

 82     <sourcecontrol type="svn" autoGetSource="true">

 83       <!--该项目的SVN路径-->

 84       <trunkUrl>https://svn.code.sf.net/p/***</trunkUrl>

 85 

 86       <!--配置的这个目录将作为CruiseControl.NET的工作目 录,CruiseControl.NET会将代码从SVN中 check out到这个目录中.-->

 87       <workingDirectory>D:\workspaces\WorkDemo</workingDirectory>

 88 

 89       <!--机器上的SVN的可执行文件路径-->

 90       <executable>C:\Program Files (x86)\VisualSVN Server\bin\svn.exe</executable>

 91 

 92       <!--SVN的用户名与密码-->

 93       <username>ifelse01</username>

 94       <password>if01else</password>

 95 

 96     </sourcecontrol>

 97 

 98     <!--些列顺序执行的任务-->

 99     <tasks>

100       <msbuild>

101         <!-- if you want the task to fail, ping an unknown server -->

102         <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>

103         

104         <workingDirectory>D:\workspaces\WorkDemo</workingDirectory>

105 

106         <projectFile>Work2013.sln</projectFile>

107 

108         <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>

109 

110         <targets>Build</targets>

111 

112         <timeout>900</timeout>

113 

114         <!--记录编译日志-->

115         <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>

116 

117 

118       </msbuild>

119 

120       <nunit>

121 

122         <path>C:\Program Files (x86)\TestDriven.NET 3\NUnit\2.5\nunit-console.exe</path>

123 

124         <!--需要确保文件夹路径存在-->

125         <outputfile>C:\CCNet\NunitResult\WorkDemo\nunit-results.xml</outputfile>

126 

127         <assemblies>

128 

129           <assembly>D:\workspaces\WorkDemo\WorkDemo.Tests\bin\Debug\WorkDemo.Tests.dll</assembly>

130 

131         </assemblies>

132       </nunit>

133 

134       <!--

135       executable:NANT的可执行文件路径.

136       buildFile:配置的build文件的路径.

137       -->

138       <!--<nant>

139         <executable>D:\workspaces\bin\nant\nant.exe</executable>

140         <buildFile>C:\CCNet\NAnt_KernelClass.build</buildFile>

141       </nant>-->

142 

143     </tasks>

144 

145     <!--执行一个程序, 可以在这里加载任何你需要执行的程序,比如Fxcop等-->

146     <!--示例1-->

147     <!--<exec executable="c:\projects\myproject\build.bat"/>-->

148     <!--示例2:-->

149     <!--<exec>

150       <executable>make</executable>

151       <baseDirectory>D:\dev\MyProject</baseDirectory>

152       <buildArgs>all</buildArgs>

153       <buildTimeoutSeconds>10</buildTimeoutSeconds>

154     </exec>-->

155     

156     <!--编译成功后,如何发布

157     sourceDir:源文件地址 

158     publishDir:要发布到的地址 

159     <useLabelSubDirectory>:是否每一个版本根据label标签创建一个字目录里并把发布内容放进去

160     -->

161     <!--<buildpublisher>

162       <sourceDir>C:\myprojects\project1</sourceDir>

163       <publishDir>\\myfileserver\project1</publishDir>

164       <useLabelSubDirectory>false</useLabelSubDirectory>

165     </buildpublisher>-->

166     

167     <!--编译成功后执行的任务-->

168     <publishers>

169       <statistics />

170       <xmllogger />

171        <!--

172       <email from="**@163.com" mailhost="smtp.163.com"

173        mailhostPassword="**" mailhostUsername="**@163.com" useSSL="false"

174        includeDetails="true"> -->

175       <!--用本地IIS发送-->

176       <email from="[email protected]" mailhost="127.0.0.1" useSSL="false"

177        includeDetails="true">

178         <users>

179           <user name="**" address="**@qq.com" group="buildmaster" />

180           <user name="**" address="**@qq.com" group="developers" />

181         </users>

182         <groups>

183           <!-- always" - 只要编译发生

184               "change" - 编译的状态改变,成功到失败,或者失败到成功

185               "failed" - 编译失败

186               "success" -编译成功

187               Fixed: 当build的状态发成改变时发送(从“失败”到“成功”)

188               也可以这样写:<group name="developers" notification="change"/>

189               -->

190           <group name="developers">

191             <notifications>

192               <NotificationType>Failed</NotificationType>

193               <NotificationType>Exception</NotificationType>

194             </notifications>

195           </group>

196           <group name="buildmaster" >

197             <notifications>

198               <NotificationType>Always</NotificationType>

199             </notifications>

200           </group>

201         </groups>

202       </email>

203       <modificationHistory onlyLogWhenChangesFound="true" />

204     </publishers>

205 

206   </project>

207 

208 

209 </cruisecontrol>

 

 

NAnt_KernelClass.build

 1 <?xml version="1.0"?>

 2 <project name="KernelClass" default="build" basedir="D:\workspaces\KernelClass2008">

 3   <property name="debug" value="true" overwrite="false" />

 4   

 5   <!--删除bin 以及 obj文件夹-->

 6   <target name="clean">

 7     <delete dir="bin" failonerror="false"/>

 8     <delete dir="obj" failonerror="false"/>

 9   </target>

10 

11   <!--加了depends=”clean” 之后执行 build会首先执行clean的工作.

12     build完以后把dll复制到D:\workspaces\WorkDemo\WorkDemo.Tests\bin\Debug

13   -->

14   <target name="build" depends="clean">

15     <csc target="library" output="bin/debug/KernelClass2008.dll"  debug="${debug}">

16       <sources>

17         <include name="*/*"/>

18         <!--exclude 这个是排除哪些文件不让其编译-->

19         <exclude name="NAnt_KernelClass.build" />

20       </sources>

21     </csc>

22     <copy todir="D:\workspaces\WorkDemo\WorkDemo.Tests\bin\Debug" flatten="true">

23       <fileset basedir=".">

24         <include name="bin/debug/KernelClass2008.dll" />

25       </fileset>

26     </copy>

27   </target>

28 </project>

 

 

你可能感兴趣的:(Build)