Transcript of Lighning Talk: PHP build process
- 1. Build Process The beginnings of Continuous Integration
- 2. Who Am I? CTO/Founder of Pamiris, Inc. Extensive NPO board
service Overseen payroll conversions & HRIS implementations
with over 600 employees BBA, MIS from EWU 2004 (manga cum laude,
BGS)
- 3. Build Process: wait... why? But PHP doesn't have to compile!
definition - Build /bild/: The process of preparing software for
deployment and/or distribution.
- 4. PHP Deployment Prep Lint (syntax/compile error checking)
SLOC (source lines of code) metrics Unit testing Code coverage
analysis Functional Testing Code style checking Cyclomatic and
N-path complexity Code duplication (DRY)
- 5. PHP Deployment Prep: Again... why should we? Ability to
track code quality trends More people/other teams can contribute
safely(er. Saflier. Saferly?) Accountability for all Nervous sleep
deprivation, anyone? Sooner found = cheaper fixed
- 6. Quick Feedback Total coverage statistics Complexity measures
CRAP index: Change Risk Anti- Patterns Pass/No Pass for tests
- 7. PHP Deployment Prep: Why doesn't it happen? Never enough
time It worked fine on my machine It didn't seem like a big deal If
it isn't easy and repeatable, it won't happen.
- 8. Build Automation: Make it easy, make it happen Developers
and QA folks alike should be able to check a commit with absolute
ease. The easier it is, the more it happens. The more it happens,
the better the code is.
- 9. Build Automation Tools GNU Make
http://www.gnu.org/software/make/ Phing (PHing Is Not Gnu make)
http://www.phing.info/ Apache Ant http://ant.apache.org/
- 10. Start Simple Get PHPUnit, behat, PHPspec or other unit test
running Get PHPLOC to run (composer makes it easy) Install a build
automation tool MAGIC... ??? profit.
- 11. Basic build.xml
- 12. My current build.xml ~175 Lines Tasks: Build (prepare,
lint, phpunit-ci, phploc, pdepend, phpmd) Build-parallel Phpcs
(coding standard analysis) Selenium-install Selenium-start
-stop
- 13. Ant usage: running the build Just 'ant' will autorun the
whole build command 'ant ' will run any part of it Different
targets for different uses Developers WIP: fast unit tests w/o
coverage or functional Developers pre-commit: all tests plus
coverage Metric tracking: all static analysis tools Pre-deploy: all
of the above
- 14. Next Steps Flesh out other valuable build steps Store build
results Automate build on check-in with Jenkins/TravisCI Add
charting (trend display) Continuous deployment
- 15. Resources http://jenkins-php.org/index.html Integrating PHP
Projects with Jenkins by Sebastian Bergman (on Kindle, etc)
http://marcelog.github.io/articles/ci_jenkins_hudson
https://www.phptesting.org/