Build,Release and Continous Integration-Part1

Posted: August 12, 2008 in Architecture Series
A well defined Build,Release and CI is a must for any BIG enterprise Project.Its further becomes  utmost important for any agile development process.There are lot of approaches and you can find lot of  articles ,products ,tools once you search on the net .Since I found there are so many tools and processes a developer or architect or any Enterprise needed to be aware of ,Through this post  I am  trying to simplify the learning and also trying to make this post a simple yet effective learing for  newbies.The root of the problem and solution of a well defined B&R and CI applied to any language and technology ,Yet to cut the scope this post will be mostly around .NET and Microsoft technologies.
 
For Continous integration concepts I would like to point out the great post made by martin fowler .A must read for anyone who is trying to understand the theoritical aspects of CI.Read it here.
 
So,What all we need,What are the tool set we use for CI?The comon components you need are :-
 
1.SourceControl Repository[From where you get and to which you submit your code.Few widely used and common tools are VSS,Subversion[SVN],CVS,Perforce etc.
2.Versioning of your codebase
3.Cleanup the repository and outputs
4.Compile your code using build tools like NANT or MSBUILD [generally .NET code but can be more complicated to Build your DB,Add custom code for your specific tasks like adding to gac and signing assemblies ,create your config entries etc
5.UnitTest :- [Few Common and most used are Xunit,Nunit,MBunit,CsUnit,QuickUnit and VSTS unittest]
6.CodeQuality Checks [Fxcop ,Ndepend]
7.Code Coverage tools-VSTS codecoverage ,Ncover,PartCover etc;
8.Documentation support[Sandcastle and Ndoc ]
9.A dashboard and services  for CI tools [CC.NET,Draco.NET ,CIfactory,Teamcity,Clover.Net etc and at client side Cctray or other notification etc]
10.Release process[Creation of msi,IIS Virtual Directory and copying the Files,creation of ZIP packages
 
You can see the scope and toolset already is pretty large and once you consider automation testing framework like QTP automation and mocking framework as well as custom plugins into your process the scope increases further.Believe me ,you ask any management of any large Enterprise projects and the scope has to be settled down at some point and you still have a lot of scope for the improvements.
 
In the following post I will Demonstrate CI with the following tools:-
 
SVN Subversion
Subversion (SVN) is a version control system . It is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS).
Download link :
http://subversion.tigris.org/

Tortoise SVN Client
TortoiseSVN is a Subversion client, implemented as a Microsoft Windows shell extension. It is free software released under the GNU General Public License.
Download link :
http://tortoisesvn.net/downloads
NAnt
NAnt is a free software (open source) software tool for automating software build processes. It is similar to Apache Ant, but targeted at the .NET environment rather than Java.
Download link :
http://sourceforge.net/projects/nant
NAntContrib
NAntContrib is the project for tasks and tools that haven’t made it into the main NAnt distribution yet. But these are the additional set of tasks which will help script writers to have the flexibility of adding new set of tasks to their NAnt scripts. These tasks include tasks for invoking different third party tools.
To use the NAntContrib, copy the NAntContrib bin’s contents to the NAnt bin.
Download link :
http://sourceforge.net/projects/nantcontrib/
NUnit
NUnit is an open source unit testing framework for Microsoft .NET. It serves the same purpose as JUnit does in the Java world, and is one of many in the xUnit family.
Download link : http://www.nunit.org/index.php
.NET Framework 2.0 or above
The Microsoft .NET Framework is a software technology that is available with several Microsoft Windows operating systems. It includes a large library of pre-coded solutions to common programming problems, a runtime or virtual machine that manages the execution of programs written specifically for the framework, and a set of tools for configuring and building applications. The .NET Framework is a key Microsoft offering and is intended to be used by most new applications created for the Windows platform.
FxCop
FxCop is a free static code analysis tool from Microsoft that checks .NET managed code assemblies for conformance to Microsoft’s .NET Framework Design Guidelines. Unlike the Lint programming tool for the C programming language, FxCop analyzes the compiled object code, not the original source code.
Downloadlink:
http://www.microsoft.com/downloads/details.aspx?familyid=3389F7E4-0E55-4A4D-BC74-4AEABB17997B&displaylang=en
NCover
Code coverage analysis is a measurement that is taken on running program code reporting how much of that code was executed. Specifically, code coverage usually tells you how many times each line of code was executed. There are various forms of coverage metrics, such as function coverage, sequence point coverage, statement coverage and branch coverage. NCover is a tool that analyzes running code and is able to determine whether code was visited or unvisited while running. Visited code is code that was executed during the running of a process, and unvisited code is code that was not executed.
Download link :
http://www.ncover.com/
MSBuild Community
MSBuild is an XML-based build engine and a tool that has been developed with customizability and extensibility in mind from its conception. By using MSBuild, you can change how your projects are built, creating customizations to fit your needs. This gets installed with the .NET runtime. MSBuild community tasks
http://msbuildtasks.tigris.org/  are the set of tasks independently developed and not part of the main task group of Msbuild. But these tasks are helpful in integrating third party tools into the build process.
CruiseControl.NET
This is one of the best tools which help the continuous integration for the rapid project development. This tool can give host many of the existing .NET based third party tools like NCover, FxCop, NUnit etc to help out continuous integration.
Download link :
http://ccnetlive.thoughtworks.com/

CCnetConfig
can be used to generate templates for different tasks. This is a better way of adding tasks to the ccnet.config file.
Download link :
http://ccnetconfig.org/
SandCastle Help File Builder
Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies and optionally integrating XML Documentation Comments. It has few problems like it is command line based and has no GUI front-end, project management features, or an automated build process like those that you can find in NDoc. Sandcastle Help File Builder will fill in the gaps and provide some of the missing NDoc-like features, as well as provide graphical and command line based tools to build a help file in an automated fashion.
Download link: http://www.codeplex.com/SHFB/Release/ProjectReleases.aspx?ReleaseId=10445
NDepend
NDepend is a tool that simplifies managing a complex .NET code base. Architects and developers can analyze code structure, specify design rules, plan massive refactoring, do effective code reviews and master evolution by comparing different versions of the code with the help of this tool.
Download link:
http://www.ndepend.com/ndependdownload.aspx
CCTray
CCTray is an optional utility for use with the CruiseControl.NET Continuous Integration server. It provides feedback upon build progress, and allows control over some of the server’s operations. It can Monitor multiple projects on many build servers, Identify the build status with a glance to the system tray, See the status of individual builds in a popup window, Audio/Visual feedback upon completion of builds, indicating success or failure, Force a build from any PC (when the CruiseControl.NET server is sleeping)
Download link :
http://ccnetlive.thoughtworks.com
 
 
In this post we will be using both NANT based approach in case you already have spent significant time in NANT as well as MSbuild based approach which I would recommend for future .Further to that I would like to mention that you can compile using only NANT but that has certain limitations which nant contib try to iliminate .Further to that we can always use msbuild task for nant[msbuild task inside nant script to compile].Similarly you can compile your code using the DEVEnv.exe itself but that does need VS installed in your build server.
Continuous Integration Process
The approach is to introduce a ccnet.config file which will invoke either the MSBUILD or the NAnt based scripts for automated build, unit test, coverage etc. The ccnet.config file is executed through the ccnet.exe. In this configuration file, steps to connect to the source control and tasks to invoke the msbuild script file(.proj) or the NAnt script file(.build) is added. This file could contain even <email> task to be executed on completion of the build success/failure. The continuous integration steps can be listed out and invoked through
http://localhost/ccnet .The .proj/.build file which is written in msbuild/nant script can host different tasks like clean, compile, unit test(NUnit), code coverage(NCover), coding standards and code quality checking(fxcop) etc.

We will continue with the script in next post.Please watchout MSBUILD based approach in Part-2 and NAnt based approach in part-3 as well as I will also post some readymade framework and tools which were quite popular like TeamCity http://www.jetbrains.com/teamcity/  , Watin  http://watin.sourceforge.net/ ,FinalBuilder http://finalbuilder.com/and Cifactory http://cifactory.org/joomla/ in future posts.I will also discuss VSTS and the pros and cons of going the VSTS route vs the OpenSource Route in future post.

Read part2 ,part3. ,Part4

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s