Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Improving code quality with Continuous Integration <ul><li>Martin de Keijzer
13/07/2010 PHPBenelux user group meeting </li></ul>
About me <ul><li>Software Engineer at Ibuildings
PHP developer for 6 years
PHPBenelux </li></ul>
Contents of this talk <ul><li>What is CI
Benefits
CruiseControl & PHPUnderControl
The tools underneath
Preparing a project
Adding your project
Questions </li></ul>
What is CI? <ul><li>A quick introduction </li></ul>
What is Continuous Integration <ul><li>Methodology
QA automation
Continuous code checking
An electronic guide </li></ul>
Benefits <ul><li>How can YOU benefit? </li></ul>
Benefits <ul><li>No more forgetting
Human errors get minimized
Run all QA processes from 1 single process
Reporting features for each run
Better overall code quality </li></ul>
CruiseControl & phpUnderControl <ul><li>A very common couple </li></ul>
Cruise Control <ul><li>Java based CI server
The core for phpUnderControl
Has it's own webserver
Extensible for multiple languages </li></ul>
PHPUnderControl <ul><li>A frontend for CruiseControl
Adjusted to the needs of a PHP developer
Easy interface </li></ul>
PHPUnderControl
PHPUnderControl
The tools underneath <ul><li>This will sound familiar </li></ul>
Tools <ul>Disclaimer : There are alternatives, it's the output format of each individual tool that counts. </ul><ul>Source...
Tools <ul>Most tools can be obtained through PEAR http://pear.php.net/manual/en/installation.getting.php </ul>
Upcoming SlideShare
Loading in …5
×

Improving code quality using CI

1,791 views

Published on

Starting Continuous Integration seems like a tedious task, this presentation will get you gradually up and running.

Published in: Technology
  • Be the first to comment

Improving code quality using CI

  1. 1. Improving code quality with Continuous Integration <ul><li>Martin de Keijzer
  2. 2. 13/07/2010 PHPBenelux user group meeting </li></ul>
  3. 3. About me <ul><li>Software Engineer at Ibuildings
  4. 4. PHP developer for 6 years
  5. 5. PHPBenelux </li></ul>
  6. 6. Contents of this talk <ul><li>What is CI
  7. 7. Benefits
  8. 8. CruiseControl & PHPUnderControl
  9. 9. The tools underneath
  10. 10. Preparing a project
  11. 11. Adding your project
  12. 12. Questions </li></ul>
  13. 13. What is CI? <ul><li>A quick introduction </li></ul>
  14. 14. What is Continuous Integration <ul><li>Methodology
  15. 15. QA automation
  16. 16. Continuous code checking
  17. 17. An electronic guide </li></ul>
  18. 18. Benefits <ul><li>How can YOU benefit? </li></ul>
  19. 19. Benefits <ul><li>No more forgetting
  20. 20. Human errors get minimized
  21. 21. Run all QA processes from 1 single process
  22. 22. Reporting features for each run
  23. 23. Better overall code quality </li></ul>
  24. 24. CruiseControl & phpUnderControl <ul><li>A very common couple </li></ul>
  25. 25. Cruise Control <ul><li>Java based CI server
  26. 26. The core for phpUnderControl
  27. 27. Has it's own webserver
  28. 28. Extensible for multiple languages </li></ul>
  29. 29. PHPUnderControl <ul><li>A frontend for CruiseControl
  30. 30. Adjusted to the needs of a PHP developer
  31. 31. Easy interface </li></ul>
  32. 32. PHPUnderControl
  33. 33. PHPUnderControl
  34. 34. The tools underneath <ul><li>This will sound familiar </li></ul>
  35. 35. Tools <ul>Disclaimer : There are alternatives, it's the output format of each individual tool that counts. </ul><ul>Source: http://www.flickr.com/photos/sebastian_bergmann/3356003644/ </ul><ul>Disclaimer : There are alternatives, it's the output format of each individual tool that counts. </ul>
  36. 36. Tools <ul>Most tools can be obtained through PEAR http://pear.php.net/manual/en/installation.getting.php </ul>
  37. 37. Tools: Version control <ul><li>CVS / SVN / Git etc..
  38. 38. Basis for detecting changes
  39. 39. Keeps track of changes
  40. 40. Keeps track of who did the changes </li></ul>
  41. 41. Tools: Documentation <ul><li>phpDocumentor
  42. 42. A standard for in-code documentation
  43. 43. Human readable documentation
  44. 44. Gives a quick understanding of code or API's </li></ul>
  45. 45. PHPUnderControl
  46. 46. Tools: Code sniffer <ul><li>PEAR package PHPCodeSniffer
  47. 47. Checks coding standards and assigns warnings and errors
  48. 48. Internal standards
  49. 49. Readability </li></ul>
  50. 50. PHPUnderControl
  51. 51. Tools: PHP Mess Detector <ul><li>Code size (long methods or classes)
  52. 52. Short method or function names
  53. 53. Cyclometic complexity
  54. 54. Rulesets at phpmd.org
  55. 55. Protects against writing complex code </li></ul>
  56. 56. PHPUnderControl
  57. 57. Tools: PHP Copy Paste detection <ul><li>Detects copied and pasted code
  58. 58. Reduces the chance of duplicate code errors </li></ul>
  59. 59. Tools: PHPUnit <ul><li>Used for automated testing
  60. 60. Checks if your assumption is still correct even after changing the code
  61. 61. Extensible (e.g. test usages you didn't assume) </li></ul>
  62. 62. PHPUnderControl
  63. 63. PHPUnderControl
  64. 64. PHPUnderControl
  65. 65. Preparing a project <ul><li>Getting ready to go </li></ul>
  66. 66. Preparing a project <ul><li>Single XML file based on Apache Ant
  67. 67. Directories for generated artifacts
  68. 68. Each job is a target
  69. 69. One 'build' target to combine the jobs for a single build </li></ul>
  70. 70. Preparing a project <? xml version = &quot;1.0&quot; encoding = &quot;UTF-8&quot; ?> < project name = &quot;example.nl&quot; default = &quot;build&quot; basedir = &quot;.&quot; > < target name = &quot;checkout&quot; > < exec executable = &quot;svn&quot; dir = &quot;${basedir}/source&quot; > < arg line = &quot;up&quot; /> </ exec > </ target > < target name = &quot;php-codesniffer&quot; > < exec executable = &quot;phpcs&quot; dir = &quot;${basedir}/source&quot; output = &quot;${basedir}/build/logs/checkstyle.xml&quot; > < arg line = &quot;--report=checkstyle --standard=Zend classes/&quot; /> </ exec > </ target > <!-- MORE TARGETS HERE -> < target name = &quot;build&quot; depends = &quot;checkout,php-documentor,php-codesniffer,phpmd,phpcpd,pdepend,phpunit&quot; /> </ project >
  71. 71. Adding your project <ul><li>Let's get the server rocking! </li></ul>
  72. 72. Adding your project <ul><li>Single XML for the server containing all projects
  73. 73. Publishers which publish data to your CI server's front-end </li></ul>
  74. 74. Adding your project < project name = &quot;projectname.nl&quot; buildafterfailed = &quot;false&quot; > < plugin name = &quot;svn&quot; classname = &quot;net.sourceforge.cruisecontrol.sourcecontrols.SVN&quot; /> < modificationset quietperiod = &quot;60&quot; > < svn localWorkingCopy = &quot;projects/${project.name}/source/&quot; /> </ modificationset > < schedule interval = &quot;120&quot; > < ant anthome = &quot;apache-ant-1.7.0&quot; buildfile = &quot;projects/${project.name}/build.xml&quot; /> </ schedule > < listeners > < currentbuildstatuslistener file = &quot;logs/${project.name}/status.txt&quot; /> </ listeners > < log dir = &quot;logs/${project.name}&quot; > < merge dir = &quot;projects/${project.name}/build/logs/&quot; /> </ log >
  75. 75. Adding your project < publishers > < artifactspublisher dir = &quot;projects/${project.name}/build/api&quot; dest = &quot;artifacts/${project.name}&quot; subdirectory = &quot;api$ < artifactspublisher dir = &quot;projects/${project.name}/build/coverage&quot; dest = &quot;artifacts/${project.name}&quot; subdirectory $ < execute command = &quot;phpuc graph logs/${project.name} artifacts/${project.name}&quot; /> < execute command = &quot;phpcb -- log projects /${ project.name }/ build / logs -- source projects /${ project.name }/ source -- ou $ < artifactspublisher dir = &quot;projects/${project.name}/build/php-code-browser&quot; dest = &quot;artifacts/${project.name}&quot; subd $ </ publishers > </ project >
  76. 76. Useful links <ul><li>CruiseControl http://cruisecontrol.sourceforge.net/
  77. 77. PHPUnderControl http://www.phpundercontrol.org/
  78. 78. Hudson (an alternative CI server) http://hudson-ci.org/ </li></ul>

×