Continuous integration

699 views
580 views

Published on

Session I did at Microsoft Developer Days in 2009

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
699
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Project with Db schema updates & sprocsIcon explanationClock : Build during the night, unattendedPackage : Create packages for test-, acceptance- and production environmentsDocument & Pen : Do so by, for example, changing configuration of connectionstringFolder : And set configuration to right folder with resourcesCheck : Run your unit tests automatedDatabase : And prepare database for integration tests and perhaps acceptance dataLightning : Make sure the build is fastFolder 2 : Put the stuff you create in some folder others can access, if necessary.Scroll : Create historical logsEnvelope : And email the build log of something went wrong
  • Top ones are paid, bottomones are free… Jedi is just in therebecause of the cool name! 
  • Everything must go in the repository, becauseyouneed to beable to getonto a clean machine, get the latestversion and beable to compile.Of coursethere are limits. Complex installsdon’tneed to be, likean OS orotherlibrariesthatneedinstallation, likeTypemock Isolator
  • What if…You checked out ClassA and ClassB and are happily editing it.So you want ClassC, but unfortunately, DeveloperB already edited it and checked his (or her) version in.You check out ClassC anyhow, also do a GetLatestVersionOnCheckout, only to find out, DeveloperB also changed something to ClassD that your ClassC suddenly depends on.Well well, sucks, but we’ll also get ClassD then…Woah! Just found out, we also need some class called ClassE! It was also added in the same changeset. Okay, let’s do so…This getting worse, DeveloperB was doing a lot of work and created a shit load of extra files. Let’s get them all…Oh oh, now we’re scr*wed. Our ClassE also depends on some change in ClassB… Now we have to start merging our own ClassA because of the changes.Solution?Either turn of multiple-check-out, which raises a bunch of other problems. Or stop using GetLatestVersionOnCheckout
  • Reduced risk:At all times you know where you are, what works, what doesn’t, bugs, etc.
  • Continuous integration

    1. 1. If you build it, you’ll ship it Dennis van der Stelt Class-A
    2. 2. Agenda • • • • What/Why about continuous integration How to automate the build Tools Development process • Anti patterns
    3. 3. what is an automated build
    4. 4. Is more than CTRL+SHIFT+B or F5 Solves integration problems early Eliminate repetitive tasks Minimize “bad builds” Improve product quality
    5. 5. What if CTRL+SHIFT+B and XCopy might seem enough?
    6. 6. What if you don’t have integration problems?
    7. 7. What if setting up builds costs time?
    8. 8. Don’t do this only once a day… do it continuously!
    9. 9. what is continuous integration
    10. 10. Continuous integration describes a set of software engineering practices that speed up the delivery of software by decreasing integration times.
    11. 11. 5 steps to continuous integration
    12. 12. source control repository
    13. 13. Source control repository Team Foundation Server SourceSafe ClearCase CVS Subversion (SVN) JEDI version control
    14. 14. Source control repository project branch libraries code unit tests branch
    15. 15. automate the build
    16. 16. 1 2 3 4 5 6 7 Clean up previous builds • Decide whether you build from scratch • prevents unexpected behavior • rebuilds everything, every time • will make the build take longer to complete 8
    17. 17. 1 2 3 4 5 6 7 8 Get latest version • Include everything • Source code • Libraries • Database schema • Build needs to be able to run on clean machine
    18. 18. 1 2 3 4 5 6 Increase version number • Include version number in assemblies • Decide whether you • Increase all assemblies • Increase only updated assemblies 7 8
    19. 19. 1 2 3 4 5 6 7 8 Build & deploy database • Create a new & fresh database • Visual Studio DataDude • Comes free now with developer edition • Deploy test data for integration tests • Usually takes a long time • Option to do this only in nightly build • Creating a large change script is a different story
    20. 20. 1 2 3 4 5 6 7 8 Build the project • Don’t build using an IDE like Visual Studio • Rather use MSBuild, TeamBuild or a 3rd party lib. • Don’t forget to automate • Help files & documentation • Installation files (setup.exe) • Release notes
    21. 21. 1 2 3 4 5 6 7 8 Run tests • Compiling code doesn’t prove it works • Unit tests do • Although they’re no 100% safety net • Run unittests continuously • Integration tests only at night • Try web tests and new Visual Studio 2010 abilities
    22. 22. 1 2 3 4 5 6 7 8 Create deployment packages • Create at least two deployment packages • Make the build available to everyone • Deploy websites to test server • Deploy ClickOnce applications to test server • Make iteration/milestone versions available • Try to make automated rollback available
    23. 23. 1 2 3 4 5 6 7 Don’t leave the build broken overnight • Make sure you’re developing on a stable base • Builds can break, but… • not too often • not during the night 8
    24. 24. 1 2 1a 3 1b 4 5 6 5a 7 5b Nightly build • Not everything has to run continuously • Database deployment • Slower integration tests • Must be able to run full build manually 8 5c
    25. 25. the tools
    26. 26. Team Foundation Server Has everything you need • Source control • Data collection • Reporting • Project tracking • For collaborative development • Supports CI since version 2008
    27. 27. MSBuild Complex XML script based on targets and tasks. Requires additional open source tasks for completeness. TeamBuild This is where Team Foundation Server runs on. It’s MSBuild with TFS integration.
    28. 28. FinalBuilder Unified graphical interface to author and execute builds with 650+ actions to execute. Integration with TFS FinalBuilder Server Continuous integration server to accompany FinalBuilder.
    29. 29. CruiseControl.NET Opensource continuous integration server. Multiple plugins available and large userbase.
    30. 30. development process
    31. 31. Development process 1. 2. 3. 4. 5. 6. 7. 8. Get latest version of integrated code Add or change a feature Build code & run tests locally Get latest version & merge Build code & run tests locally Check-in source code Verify automated build succeeds Goto 1
    32. 32. Working with changesets Class A A B B Class E A B Class B Class D Class C B A A B = Developer A = Developer B
    33. 33. Some best practices • • • • Setup a build a.s.a.p! Check-in as often as you can Use a RAM disk to speed up the build Use a Continuous Integration Token
    34. 34. benefits
    35. 35. Benefits of CI • Reduced risk • Confidence in frequent deployments – New features more rapidly – Better feedback on those features • Better customer relations • Improved team morale
    36. 36. anti patterns in continuous integration
    37. 37. It’s an anti pattern to delay check-ins and create bottleneck commits resulting in going home late
    38. 38. Or from a different view, having files checked out overnight means providing the team with coffee or cookies
    39. 39. It’s an anti pattern to not to use feedback of a broken build, but don’t overdo it resulting in ignoring the notifications
    40. 40. And breaking the build will make you buy cake for the team… … or wear the bunny suit!
    41. 41. Conclusion • • • • Automate your build Continuous Integration is the key! Use the best tools available It will save you time and money
    42. 42. Next steps… • • • • • • http://bloggingabout.net/blogs/dennis/ http://twitter.com/dvdstelt/ dennis@class-a.nl Visit Devnology for discussions Come to SDN Conference! Try out Team System 2010
    43. 43. Thanks for attending Dennis van der Stelt

    ×