Showing posts with label Continuous Integration. Show all posts
Showing posts with label Continuous Integration. Show all posts

Monday, February 18, 2008

Does "Done" Mean "Shippable"?

Is your software 'Done' or 'Shippable'? If you're first thought is that it doesn't matter because they are the same thing then maybe you should read this article.

Does "Done" Mean "Shippable"?

kick it on DotNetKicks.com Shout it

Thursday, May 17, 2007

Continuous Integration with Subversion and AssemblyInfo

Building a continuous integration environment is becoming easier every day. How nice is it to have all of your source code automatically versioned with each build from continuous integration?
Here are some steps that might help when using Subversion:

A task to retrieve the latest subversion change number from the repository


<echo message="Retrieving Subversion revision number"/>
<property name="svn.revision" value="not_available"/>
<exec
program="c:\program files\subversion\bin\svn.exe"
commandline="log ${code.trunk} -r HEAD --xml"
output="_revision.xml"
failonerror="false"/>
<xmlpeek
file="_revision.xml"
xpath="/log/logentry/@revision"
property="svn.revision"
failonerror="false"/>
<echo message="Using Subversion revision number: ${svn.revision}"/>


Now add a task that will update all of the CommonAssemblyInfo.cs and AssemblyInfo.cs files that have the AssemblyVersion attribute defined.


<target name="SetVersions" description="Stamp the version info onto assemblyinfo.cs files">
<foreach item="File" property="filename">
<in>
<items basedir=".">
<include name="**\AssemblyInfo.cs"></include>
<include name="**\CommonAssemblyInfo.cs"></include>
</items>
</in>
<do>
<script language="C#">
<code><![CDATA[
public static void ScriptMain(Project project)
{
StreamReader reader = new StreamReader(project.Properties["filename"]);
string contents = reader.ReadToEnd();
reader.Close();
string pattern = @"\[assembly: AssemblyVersion\("".*""\)\]";
if (Regex.IsMatch(contents, pattern))
{
string replacement = string.Format(
"[assembly: AssemblyVersion(\"{0}.{1}.{2}.{3}\")]",
project.Properties["build.version.major"],
project.Properties["build.version.minor"],
project.Properties["build.version.build"],
project.Properties["build.version.revision"]
);
string newText = Regex.Replace(contents, pattern, replacement);
StreamWriter writer = new StreamWriter(project.Properties["filename"], false);
writer.Write(newText);
writer.Close();
}
}
]]>
</code>
</script>
</do>
</foreach>
</target>



And now tie it all together with this little task before executing your build, and you should have an accurately versioned build every time!


<property name="build.version.major" value="1" />
<property name="build.version.minor" value="0" />
<property name="build.version.build" value="0" />
<property name="build.version.revision" value="*" />

<target name="UpdateVersions">
<call target="RetrieveSVNChangeNumber" />
<property name="build.version.build" value="${svn.revision}" />

<call target="SetVersions" />
</target>



Of course the next step could be to check in all of those updated assembly info files...

kick it on DotNetKicks.com Shout it

Saturday, February 24, 2007

New adventures in Continuous Integration

It has been a while since I have setup a continuous integration environment from scratch, but here again I find myself doing it.

Each time I setup an environment there is something subtly different, or there are better ways to do things based on new releases of CruiseControl, NAnt, NUnit and friends.

Luckily there are blog entries like this one that can help with parts of the process.

Continuous Integration Setup

kick it on DotNetKicks.com Shout it

Monday, June 12, 2006

Versioning Multiple Assemblies

Ever wanted to ensure that all assemblies in your solution have the same version number when you deploy them? Of course. This is a succinct little article about one of the many ways of ensuring you can track those deployed assemblies. I have been using this technique, or a variation of, for a number of years now, and you'd be surprised how handy it can be.
http://weblogs.asp.net/lorenh/archive/2004/09/20/232200.aspx

kick it on DotNetKicks.com Shout it