Devsta 2008 day 0: Source Control and CI

Alright so I’m pretty excited about the Devsta competition. So much so that I’m starting a day early. Given that the requirements aren’t actually released for about 8 hours, you might think that there isn’t much to do yet. But of course, you’d be wrong :)

First up is figuring out where to host the code.

Source control is a mandatory requirement.
- Ayende Rahien, Source control is not an option you can postpone to vNext

Although I’ve taken the quote somewhat out of context, I still agree with the statement. Not only do I want source control so that I can track my history and be able to back out mistakes (we all make those right?) but I’d also like my source control to be hosted offsite (i.e. By someone with more infrastructure than me).

I’d like to host the code offsite for 2 reasons. Firstly, over the next week I expect to be at about 6 machines and I’d like to be able to work from any of those locations. Secondly, I really don’t want my solution destroyed the day before the deadline because of catastrophic HDD failure (or laptop theft or whatever).

Depending on your preference of source control system you have differing levels of free hosting options available to you. If you are into Subversion (which I generally am) or CVS (which I am not) then there are a few options for freely hosted source control. Even the new kid on the block, GIT, has an option or two available.

Given that this is a Microsoft competition however, I’d really like to be using Team Foundation Server. The only real option that I can find after a few hours of wandering around the web is CodePlex. At first I rejected CodePlex as an option because it always allows read-only access to anonymous users.

As I didn’t have many other options I signed up anyway. I already have a few projects on CodePlex but I’d forgotten that when you sign up, your project remains private for 30 days (or until you publish it, whichever comes first). Perfect, by then the competition will be over anyway.

Creating a new project is ridiculously easy. Once you have an account for CodePlex you can just click the Create New Project link on the home page, fill in 2 fields (Project Name and URL), agree with a EULA, and pass a CAPTCHA. Click Finish. That’s it! You now have a project web site with a wiki, a discussion board, an issue tracker and of course, space on the CodePlex TFS.

I’m using the Visual Studio Team Explorer to access the code and the Source Code tab of your project site contains connection details for you. I found that I had to wait about 15-20 minutes before my account was actually available from the Team Explorer.

OK, so now I have source code in the cloud but I still have many hours before the competition starts. What do I do now? Well, after wandering around CodePlex for a while I found the TFS Plug-in for CruiseControl.NET. I’d never tried to set up Continuous Integration before as it always seemed harder than it needed to be but today is the day.

Boy was I pleasantly surprised. The page linked above actually has instructions for setting up CruiseControl.NET with CodePlex which is as simple as editing an XML file. The sample provided has a 30-line XML file which is pretty easy to follow. It sets up a single project with a source control block and a task to execute MSBuild and build your project.

So now whenever I make changes to the code and check them in, my CruiseControl machine (it’s a VM) does a get latest on the repository and builds the solution. Neat. I even get a website which tells me what’s been going on with my build process and a system tray application (CCTray) that does the same thing. After a quick hunt around I even found a Vista SideBar Gadget that monitors my build as well.

Browsing through the build reports I notice that the master report for each build is mocking me with “There are no unit tests for this project”. Fine, you win this round CCNet. Or do you?

It seems that CruiseControl.NET is perfectly capable of working with MSTest (The Microsoft Unit Testing system) out of the box, it just doesn’t show you any of the options. This page was invaluable for showing how to mess with the CCNet configuration file to run MSTest and add it’s results to the website.

A key thing to remember is that MSTest will not create a results file if it already exists and CCNet needs it to have a unique name to merge it into it’s reports. The answer (as the post points out) is to delete the results file before each run. It’s OK though, your CruiseControl projects build reports are all remembered and they contain my test results anyway.

The one thing I still continued to have issues with was getting those build reports to generate. I think this is because the version of MSTest which ships with VS2008 spits out reports in a different format than the one VS2005 ships with. It seems that the MSTest XSL files which come with CCNet are for VS2005. Luckily the same server had XSL files for MSTest 2008 with CruiseControl.NET on it. Too easy.

Now I have a test project that can make or break a build. Sweet, I have built an infrastructure for running my competition entry development process in a professional manner and it has taken an afternoon. Why don’t we do this more often?

Continuous Integration seems to have a built a name for itself as being hard to do. Without ever coming into into contact with CCNet I have set up CI in an afternoon. As the project progresses I will have constant feedback over whether or not I am making a mistake. This is great because my CI VM (101 1995?) will remain the same for the life of the project. If I install some new tool and take a dependency my build will break until I fix it ensuring that I keep track of these things.

The benefits would be even greater if I was working in a team environment. Then I’d quickly and easily be able to see if my build was broken at any given time and I’d always have the most up to date, working copy of the code.

Admittedly I have barely scratched the surface of the tools which CCNet makes available to me but I think I have grabbed the low hanging fruit here. I strongly urge you to check out CruiseControl.NET. It really isn’t that hard to set up and get running.

Well, the wife is back from the Perth Royal Show so I’m stocked up on some of the sourest lollies money can buy (Apple Warheads are the bomb), I have a fridge full of Coca-Cola (I’m not hard enough to do Red Bull or V. I had a can of Mother once and I think it did permanent damage to my liver, kidneys and heart) and there’s even a carrot cake in the fridge.

Just enough time left to grab 6 or 7 hours of sleep and then I’m ready to prove I can be a devsta. Are you?

Posted by: Mike Minutillo
Last revised: 27 May, 2011 02:42 PM History


29 Sep, 2008 05:23 PM @ version 0

Cheers Mitch. Thanks for your support.

It's been a bit of a hectic day to be honest but I feel that Jarred and I have a prize-worthy idea.

We'll see if the judges agree I suppose :)

29 Sep, 2008 05:55 AM @ version 0

Great post Mike. If only I were a devsta too! I'll be keenly following your progress...

No new comments are allowed on this post.