Continuous Integration


Published on

An introduction to CI concepts

  • Be the first to comment

  • Be the first to like this

Continuous Integration

  1. 1. Continuous Integration<br />Better building<br />
  2. 2. What is Continuous Integration?<br />CI is a software development practice invented to:<br />Ease integration<br />Self test builds<br />Reduce bug build up<br />Increase automation<br />Give greater project state visibility<br />Allow developers to concentrate on coding<br />
  3. 3. How is this achieved?<br />It’s achieved by continually integrating<br />(in other words checking in with the main branchfrequently)<br />and then having every integration verified<br />by automatically kicking off a tested build<br />
  4. 4. What’s the benefit?<br />
  5. 5. Avoiding late bugs<br />By integrating continually you know about more bugs in code ahead of time rather than just before release<br />
  6. 6. Creating a more cohesive team<br />Everybody integrates with everyone else frequently<br />Avoid development ‘islands’<br />Know about merging difficulties ahead of time<br />Avoid people saying<br />“When did we decide to upgrade that jar to 2.0-alpha pre-release?”<br />“I thought you fixed that months ago”<br />
  7. 7. Enhancing project visibility<br />Everyone (even non-developers!) can see the state of a project at any given time; now or in the past<br />Generated reports for projects for things such as code test coverage, code style/warnings, change logs, bug checking etc<br />Know what made (and broke!) a particular version of a deployed release<br />
  8. 8. Create deployable software<br />Software should, as much as possible, work<br />CI helps developers keep their software deployable<br />Which keeps release cycles short<br />Which is good for business<br />Stops “Well, it works on my machine”<br />
  9. 9. Create better software<br />Code is tested early and often<br />Reports can show progress in meeting coding standards<br />Test are done in parallel, not at the end<br />No integration points<br />Builds become a no-brainer<br />Defects are identified earlier<br />Defects are fixed when less costly<br />Easily repeatable testing<br />
  10. 10. This is the cool dude that came up with it: Martin Fowler<br /><br />
  11. 11. Martin Fowler’s 10 Principles of CI<br />Maintain a single source repository<br />Automate the build<br />Make your build self testing<br />Everyone commits all day, every day<br />Every commit is built<br />
  12. 12. Martin Fowler’s Principles cont…<br />Keep the build fast<br />Test in a clone of the production environment<br />Make it easy for anyone to get the latest executable<br />Everyone can see what is happening<br />Automate deployment<br />
  13. 13. Maintaining a Single Source Repository<br />A version control repository has to include ALL needed sources to build<br />And nothing else<br />CVS, SVN, Git, etc…<br />Issue: external dependencies<br />Keep in repository, or<br />Dependency management with repository of referenced binaries, e.g. maven, ivy<br />
  14. 14. Hang on, what’s in a build?<br />
  15. 15. When to do a build<br />At every check-in<br />Not simply over night!<br />Whenever a dependency changes<br />
  16. 16. How to do a build<br />Using a single build script <br />Could use <br />Ant<br />Maven<br />Make<br />…<br />Should be able to be run from the command line<br />Should have no external dependency such as an IDE<br />
  17. 17. When the build fails…<br />Make sure it fails fast<br />Fix it immediately!<br />The world will continue to turn<br />
  18. 18. Code inspections<br />Test coverage tools reports highlight where to focus testing efforts<br />Clover<br />Cobertura<br />Static Analysis tools read source code to check for best practices and identify weak spots<br />Checkstyle<br />Findbugs<br />CI helps you track these over time<br />Metrics can be established to ensure quality<br />
  19. 19. Generating documentation<br />CI can automatically generate documentation for every build<br />Ensuring it is always current<br />Removes the burden from developers<br />Code inspection reports add to documentation<br />
  20. 20. CI Mantra<br />
  21. 21. That’s it really<br />