In this article and screen cast we will discuss the idea behind the CI process and focus on the technical tricks that we need to make in order to get this working for a SharePoint 2010 project using Team City and Subversion.
One of the first things that you will want to do for any development project is setup your Continuous Integrationprocess. The value of having a server automatically monitor your source code repository for changes and validating they work is immense
Its worth mentioning that doing Continuous Integration is not something you will want to leave until later in the project. Waiting means the solution gets bigger and more complex which in turn make the setup more comples. My recommendation: Get this configured early, during Sprint 0 (i.e. before you write any real production code) if at all possible.
The basic CI Process
The diagram below shows the normal process that occurs.
(1) a developer checks in some code changes to the source code repository.
(2) The CI server monitors the source code repository for any changes
When changes are detected the code is retrieved and the automated build is started. This build will normally include running Unit, Integration and Build Verification tests.
(3) The success or failure of the automated build is reported back to the Team (including the developer).
In some teams breaking the build means the developer has a forfeit of some sort. The idea is to encourage team work but also to discourage broken builds.
When the build breaks!
A term I read recently, ‘Stop-the-Line’, is used in Toyota manufacturing process where any problem results in the production line being stopped until the cause of the problem is found, resolved and ideally prevented from re-occurring.
This should be the same when a build breaks; the whole Team should stop and help get the build working again. It is not just a problem for the developer who last checked in – the whole team need the process and need the builds to be working.
Setting Up in Sprint 0
The actual process described above is a little into the development cycle, when the build is in place and when the team are working on production code. Before this can happen there needs to be a process put in place. I refer to this initial as getting the strawman solution done.
In general, a strawman is an object, document, person, or argument that temporarily stands in for and is intended to be “knocked down” by something more substantial.
The aim is to take some code, which will be replaced hence the Strawman term through the CI process and get the team build notifications working. You should aim to prove the successful builds but also what happens when the build fails. Did the team get notified? and did they react?
The Strawman Exercise
21apps is a small and geographically dispersed team, we make extensive use of cloud based services for things like source control as they prove to be cost effective and flexible and our strawman process tends to follow these steps:
1) Create a repository for the project (Hosted Subversion)
2) Create the strawman project (Simple ‘hello world’ web part)
3) Create a simple build script – small steps mean a successful compile is our objective
4) Create a automated build configuration on our CI server – we use Team City
5) Prove the successful and failed builds
In this post we are focusing on step (4) setting up Team City as our CI server.
To make this easier I have provided a quick video walkthrough on what we have done for the early builds of Project Aberdovey- the process will be very similar for your SharePoint 2010 solutions.
Key areas that are highlighted in the video that you will enable you to build SharePoint 2010 projects in Team City.
If you are using MSBuild ensure you set the MSBuild version to Microsoft.Net Framework 3.5 and x64 run platform.
Force Team City to use MSBuild 4.0 as this is needed by adding the Environment Variable
Reference Syntax: %env.MSBuild%