Continous integration


Published on

At J and Beyond 2011, I presented a session about using Continuous integration processes during Joomla and PHP development. I present the concepts of CI, and give some direction where to start setting it up yourself.

Published in: Technology

Continous integration

  1. 1. Continuous Integration (CI) Jeremy Wilken @gnomeontherun Lead Developer @ Joomlashack
  2. 2. What CI is not <ul>A program, tool, or something you install </ul><ul>A goal or something that you complete </ul>
  3. 3. The obligatory definition <ul>“ 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 test ) to detect integration errors as quickly as possible.” - Martin Fowler with emphasis added </ul>
  4. 4. My shorter version <ul>“ Continuous Integration is a software development process , where members of a team combine and build their code regularly, run automated tests , and distribute a copy of the program for testing or use.” - Adapted from Martin Fowler's definition </ul>
  5. 5. An example development cycle <ul><li>Team of 5 developers, writing Java
  6. 6. Programmed individual parts separately
  7. 7. Merged and attempted to compile code
  8. 8. Debugging cycle until compiles
  9. 9. Product testing and further debugging
  10. 10. Product release completed </li></ul>
  11. 11. Goals of using a CI process <ul><li>Reduced bugs
  12. 12. Faster development
  13. 13. Better code management
  14. 14. Automated building
  15. 15. Unit tests </li></ul><ul><li>Deployment of files
  16. 16. Version control with regular commits
  17. 17. Improve development workflow
  18. 18. Reduce risks </li></ul>
  19. 19. Pillars of CI Version Control Build Management Self Testing Deployment
  20. 20. Version Control <ul>Manages the source code, tracks changes, merge code changes <li>Examples: Subversion, Git, Mercurial
  21. 21. Vital for single developers and large teams
  22. 22. Put everything in version control </li></ul>
  23. 23. Build Management <ul>Build programs compile or integrate the code base of a project, and manage other automated tasks <li>Examples: Phing, Ant
  24. 24. You can create custom tasks if they don't exist
  25. 25. Should contain any steps that are repeatable </li></ul>
  26. 26. Self Testing <ul>Running code tests to verify code executes, by testing the parts individually <li>Examples: phpUnit, Selenium
  27. 27. The most difficult aspect to get started with
  28. 28. Can test both the code, and browser functionality </li></ul>
  29. 29. Deployment <ul>Making the built program available immediately for testing or use <li>Examples: FTP, SCP, Dropbox
  30. 30. Can make files available on servers or locally
  31. 31. Can be run after a successful build </li></ul>
  32. 32. <ul><li>Code commit or timer triggers build
  33. 33. CI server updates to latest code revision
  34. 34. CI server starts a new build
  35. 35. Build program executes tests and any code analysis, integrates code base into useable form
  36. 36. CI server deploys files </li></ul>The basic CI process
  37. 37. Example setup for PHP projects Version Control Subversion or Git Build Management Phing Self Testing phpUnit Deployment SCP/FTP/Network Continuous Integration Server Jenkins CI
  38. 38. Example setup for PHP projects
  39. 39. Example setup for PHP projects
  40. 40. Example setup for PHP projects
  41. 41. Example setup for PHP projects
  42. 42. Getting started with CI <ul><li>Start small, adding new steps slowly
  43. 43. Begin with version control
  44. 44. Put everything under version control
  45. 45. May want automated, can start with manual </li></ul><ul><li>Setup a build process
  46. 46. Use an old computer or virtual machine as server
  47. 47. Its a change of mindset, not just tools
  48. 48. Add unit tests as you update code </li></ul>
  49. 49. Resources <ul><li>Continuous Integration: continuousIntegration.html
  50. 50. Jenkins:
  51. 51. Phing:
  52. 52. PHPUnit:
  53. 53. Jenkins with PHP: </li></ul>
  54. 54. Questions and Answers Jeremy Wilken @gnomeontherun