Leveraging Continuous Integration For Fun And Profit!

3,527 views

Published on

This is an introduction to the concepts of Continuous Integration (with a little bit of Agile/XP thrown in for good measure).

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,527
On SlideShare
0
From Embeds
0
Number of Embeds
2,208
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Avoid “Build on my machine” syndromeMetrics = coverage, complexity, coherence, couplingConformance = Styles, FxCop
  • Checkin often = average every 15 min to 30 minGood guide on when to stop = Unit test is green
  • Leveraging Continuous Integration For Fun And Profit!

    1. 1. Leveraging Continuous Integration for Fun and Profit!<br />Jess Chadwick<br />Independent Consultant<br />http://blog.jesschadwick.com<br />
    2. 2. Agenda<br />What is Continuous Integration?<br />How does it fit in to the Agile lifecycle?<br />How do I implement it?<br />Best Practices<br />
    3. 3. What is Continuous Integration?<br />Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including tests) to detect integration errors as quickly as possible.<br />Many teams find that this approach leads to significantly reduced integration problemsand allows a team to develop software more rapidly.<br />Martin Fowler, September 2000<br />
    4. 4. Layers of Quality Assurance<br />
    5. 5. Continuous Integration in XP<br />
    6. 6. Benefits of Continuous Integration<br />
    7. 7. Exponentially Building Value<br />
    8. 8. Components<br />
    9. 9. CI Servers<br />
    10. 10. Covert Operation<br />Can’t get your team to buy in?<br />Run it on your own box!<br />
    11. 11. Build Scripts – NAnt<br /><?xml version="1.0"?><br /><project name="Hello World" default="build" basedir="."><br /> <description>The Hello World of build files.</description><br /> <property name="debug" value="true" overwrite="false" /><br /> <target name="clean" description="remove all generated files"><br /> <delete file="HelloWorld.exe" failonerror="false" /><br /> <delete file="HelloWorld.pdb" failonerror="false" /><br /> </target><br /> <target name="build" description="compiles the source code"><br /> <csc target="exe" output="HelloWorld.exe" debug="${debug}"><br /> <sources><br /> <includes name="HelloWorld.cs" /><br /> </sources><br /> </csc><br /> </target><br /></project><br />
    12. 12. Build Scripts – MSBuild<br /><Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><br /> <PropertyGroup><br /> <OutputPath>.in</OutputPath><br /> </PropertyGroup><br /> <Target Name="FooCompilation"><br /> <MakeDir Directories= "$(OutputPath)"/><br /> <Copy SourceFiles="Image.jpg" <br />DestinationFiles="$(OutputPath)Image.jpg"/><br /> <Csc Sources="Foo2.cs" TargetType="module"<br />OutputAssembly="$(OutputPath)Foo2.netmodule" /><br /> <Csc Sources="Foo1.cs" TargetType="exe"<br />AddModules="$(OutputPath)Foo2.netmodule" <br />LinkResources="Image.jpg" <br />OutputAssembly="$(OutputPath)Foo1.exe" /><br /> </Target><br /></Project><br />
    13. 13. Build Scripts – psake<br />properties { <br /> $testMessage = 'Executed Test!' <br /> $compileMessage = 'Executed Compile!' <br /> $cleanMessage = 'Executed Clean!' <br />}<br />task default -depends Test<br />task Test -depends Compile, Clean { <br /> Write-Host $testMessage<br />}<br />task Compile -depends Clean { <br /> Write-Host $compileMessage<br />}<br />task Clean { <br /> Write-Host $cleanMessage<br />}<br />
    14. 14. Build Scripts – rake<br />#!/usr/bin/env ruby<br />require 'ftools'<br />def make_directories<br />File.makedirs "html"<br />File.makedirs "html/images"<br />End<br />def generate_html<br /> system %{./runwpbrake.wpb}<br />end<br />def build<br />make_directories<br />generate_html<br />end<br />build<br />
    15. 15. DEMOLet’s see it in action!<br />
    16. 16. Notifications<br />
    17. 17. Notifications – Lava Lamps<br />http://agileworks.blogspot.com/2009/02/lava-lamp-with-cruisecontrol.html<br />
    18. 18. Notifications – iPhone app<br />Yeah – there’s an app for that.<br />
    19. 19. Notifications – Brian the Build Bunny<br />Brian Woodward: http://www.woodwardweb.com/gadgets/000434.html<br />
    20. 20. Best Practices<br />Build must be green at the end of the day<br />Never check in code and leave office (ninja commit)<br />Stay and fix the code OR revert the check in<br />Check in often<br />Less chance of merge conflict<br />Always have the latest code<br />Never check in or check out of a broken build<br />
    21. 21. Best Practices – cont’d<br />Communicate<br />Be informed. Keep up-to-date with build status<br />If you broke the build, tell the team<br />Merge conflict? Talk to - don’temail - the other team member(s)<br />Be familiar with the build process<br />Don’t have to be the ‘build master’ but need to know how to troubleshoot and fix<br />
    22. 22. Various Build Types<br />Continuous: Run on every commit (give or take)<br />Lean & Fast<br />Very basic validation<br />Timed: Hourly, Nightly, etc.<br />Longer<br />More in-depth<br />Deployment<br />Utility<br />Much like scheduled tasks<br />For ease of use<br />
    23. 23. But there’s more!<br />Post-Build<br />Database upgrade<br />Code analysis (coverage, quality metrics, compliance)<br />Packaging<br />Deployment<br />
    24. 24. Continuous Deployment<br />Shrink the ‘Last Mile’ (QA, UAT, Production)<br />Reduce risk<br />Exercise deployment process early<br />Software always ready for deployment<br />
    25. 25. Discussion Time<br />Viewpoints<br />Experiences & Tips<br />Values<br />http://blog.jesschadwick.com<br />Twitter: jchadwick<br />jchadwick@gmail.com<br />

    ×