Continuous Integration Step-by-step
         php|tek Chicago 2009
Who am I ?
Michelangelo van Dam

Independent Enterprise PHP consultant
Co-founder PHPBelgium

Mail me at dragonbe [at] gma...
Topics
•   Development practices       •   PHP Toolset
    - Live Development              - Subversion
    - Shared Drive...
Development Practices




          4
Live Development

•   development on “live” server
•   errors, failures and warnings exposed
•   potential security risks
...
Shared drive

•   using a shared drive to store code base
•   risk of overwriting each other’s work
•   code is uploaded t...
Staged Environments

•   separate platform for each “stage” of development
    - LOCAL for local development
    - DEV to ...
Version Control

•   each change of code is registered (revision)
•   code conflicts are detected
•   release management po...
Automation

•   write once, run many
•   is less vulnerable to human error
    - humans still write scripts to automate pr...
Continuous Integration
•   automated process
    - build
    - test
    - deploy
•   in a continuous way
    - after each ...
PHP Toolset




     11
Versioning your code
•   Subversion
    - more options then CVS
    - can be integrated with GIT
•   easy set up / maintai...
Document your code

•   PHPDocumentor
    www.phpdocumentor.org
•   provides immediate API
    documentation
•   based on ...
Check your code

•   PHPLint
•   checks your code on coding errors
•   creates documentation based on source code
•   http...
Test your code
•   PHPUnit (phpunit.de)
    - family of the xUnit testing suites
•   easy to learn, hard to do ...
•   eas...
Debug your code

•   Xdebug (xdebug.org)
    - advanced debug reporting
    - profiling features
•   Integrates well with o...
Validate your code

•   PHP_CodeSniffer
•   PEAR package
•   checks your code for coding standards
•   http://pear.php.net...
Build your code

•   Phing (phing.info)
•   alternate for ANT
•   building is more automating previous steps
•   ensures y...
Let’s automate this all !
•   CruiseControl as your CI system
•   phpUnderControl has a more detailed interface
•   uses P...
Example phing build.xml




           20
Conclusion

         CI automates manual processes
continues to do so on each cycle (“continuous”)
        reports on succ...
Credits

                   Lomo elePHPant
http://www.flickr.com/photos/jakobwesthoff/3231273333/

               ElePHPant...
License
This presentation is released under the Creative Commons
Attribution-Share Alike 3.0 Unported License
You are free...
Thank you

       Slides available on
http://slideshare.net/DragonBe

  Vote this presentation on
     http://joind.in/444...
Upcoming SlideShare
Loading in …5
×

Continuous Integration Step-by-step

5,526 views

Published on

Starting of with familiar circumstances that all developers have seen in their career towards using tools that help document, validate and test their code, because that's what CI is all about for PHP development

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

No Downloads
Views
Total views
5,526
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide




  • convince audience this is BAD
    who knows / does this ???






  • Versioning essentials


  • PHPUnit is a separate talk (see Sebastian Bergmann)









  • Continuous Integration Step-by-step

    1. 1. Continuous Integration Step-by-step php|tek Chicago 2009
    2. 2. Who am I ? Michelangelo van Dam Independent Enterprise PHP consultant Co-founder PHPBelgium Mail me at dragonbe [at] gmail [dot] com Follow me on http://twitter.com/DragonBe Read my articles on http://dragonbe.com See my profile on http://linkedin.com/in/michelangelovandam 2
    3. 3. Topics • Development practices • PHP Toolset - Live Development - Subversion - Shared Drive - PHPDocumentor - Staged Environments - PHPUnit - Version Control - Xdebug - Automation - Phing - Continuous - CI Integration 3
    4. 4. Development Practices 4
    5. 5. Live Development • development on “live” server • errors, failures and warnings exposed • potential security risks • no way to revert back (w/o backups) 5
    6. 6. Shared drive • using a shared drive to store code base • risk of overwriting each other’s work • code is uploaded to “live” server for testing • quick fixes occur on “live” environments for speed • same issues as with “live development” 6
    7. 7. Staged Environments • separate platform for each “stage” of development - LOCAL for local development - DEV to combine all development of all developers - TEST to test the application(s) - ACC for acceptance by the customer(s) - PROD as production or “live” system 7
    8. 8. Version Control • each change of code is registered (revision) • code conflicts are detected • release management possible • reverting to previous revisions • backup 8
    9. 9. Automation • write once, run many • is less vulnerable to human error - humans still write scripts to automate processes ! • can be scheduled, triggered, pushed and pulled • behaves always in the same way - so results can be predictable 9
    10. 10. Continuous Integration • automated process - build - test - deploy • in a continuous way - after each commit into versioning system - at specific intervals (e.g. nightly builds) • always a “deployable” release 10
    11. 11. PHP Toolset 11
    12. 12. Versioning your code • Subversion - more options then CVS - can be integrated with GIT • easy set up / maintain - all OSes (Windows, Mac, Linux, ...) - great support in tools (IDE and regular clients) • good documentation (http://subversion.tigris.org) 12
    13. 13. Document your code • PHPDocumentor www.phpdocumentor.org • provides immediate API documentation • based on in-code documentation 13
    14. 14. Check your code • PHPLint • checks your code on coding errors • creates documentation based on source code • http://www.icosaedro.it/phplint/ • or use php -l <file.php> 14
    15. 15. Test your code • PHPUnit (phpunit.de) - family of the xUnit testing suites • easy to learn, hard to do ... • easy to install (using PEAR) • provides extra features - code duplication detection (cdd) - code coverage reporting (with Xdebug) - test driven documentation 15
    16. 16. Debug your code • Xdebug (xdebug.org) - advanced debug reporting - profiling features • Integrates well with other tools (like PHPUnit) 16
    17. 17. Validate your code • PHP_CodeSniffer • PEAR package • checks your code for coding standards • http://pear.php.net/package/PHP_CodeSniffer 17
    18. 18. Build your code • Phing (phing.info) • alternate for ANT • building is more automating previous steps • ensures you’ll run all steps the same way 18
    19. 19. Let’s automate this all ! • CruiseControl as your CI system • phpUnderControl has a more detailed interface • uses Phing build files to process all previous steps • generates reports for each stage • triggered by - commits into the repository - scheduled building processes (e.g. each night) 19
    20. 20. Example phing build.xml 20
    21. 21. Conclusion CI automates manual processes continues to do so on each cycle (“continuous”) reports on successes and failures frees up versioning system resources 21
    22. 22. Credits Lomo elePHPant http://www.flickr.com/photos/jakobwesthoff/3231273333/ ElePHPant to the rescue http://www.flickr.com/photos/tobiasschlitt/2733763988/ 22
    23. 23. License This presentation is released under the Creative Commons Attribution-Share Alike 3.0 Unported License You are free: - to share : to copy, distribute and transmit the work - to remix : to adapt the work Under the following conditions: - attribution :You must attribute the work in the manner specified by the author or licensor - share alike : If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license See: http://creativecommons.org/licenses/by-sa/3.0/ 23
    24. 24. Thank you Slides available on http://slideshare.net/DragonBe Vote this presentation on http://joind.in/444 24

    ×