Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Continuous Integration at Mollie

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Chargement dans…3
×

Consultez-les par la suite

1 sur 56 Publicité

Continuous Integration at Mollie

Télécharger pour lire hors ligne

In this talk, I will discuss our experiences at Mollie with setting up the Jenkins Continuous Integration server for all our PHP projects. The talk will be aimed at developers with little or no experience with CI.

In this talk, I will discuss our experiences at Mollie with setting up the Jenkins Continuous Integration server for all our PHP projects. The talk will be aimed at developers with little or no experience with CI.

Publicité
Publicité

Plus De Contenu Connexe

Diaporamas pour vous (20)

Les utilisateurs ont également aimé (20)

Publicité

Similaire à Continuous Integration at Mollie (20)

Plus récents (20)

Publicité

Continuous Integration at Mollie

  1. 1. Continuous Integration for PHP www.mollie.nl
  2. 2. Contents • About Mollie • What is CI • What’s in it for you? • How to set it up • Tips • Q&A
  3. 3. • Payment Service Provider • iDEAL, Pay-per-call, Premium SMS, etc. • SMS gateway • HTTP API, SMPP, Email to SMS, etc. • Located in Amsterdam, near Vondelpark • Four developers
  4. 4. Codebase 1/2 • Main project: 250K LOC • New code is pretty good, but... • lots of code created around 2004 (when magic_quotes was cool)
  5. 5. Codebase 2/2 • Git as SCM • Also: • Plugins for OpenCart, Magento, WHCMS • Example API classes • Internal projects
  6. 6. Technology • Nothing too complicated: • Nginx • PHP • MySQL • Redis
  7. 7. Continuous Integration
  8. 8. Theory In software engineering, continuous integration (CI) implements continuous processes of applying quality control — small pieces of effort, applied frequently. Continuous integration aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development. (source:Wikipedia)
  9. 9. In practice Run all tests and create some reports after every commit.
  10. 10. Why is it useful? 1/2 • All tests are run after every commit. • You always know if you can deploy after a commit. • You know who broke a test.
  11. 11. Why is it useful? 2/2 • You can get pretty graphs • Provides trends • Motivational for developers • First step to deploying from SCM • No more “works for me”.
  12. 12. Meet Jenkins
  13. 13. What’s in it for you?
  14. 14. PHPUnit
  15. 15. Code coverage 1/4
  16. 16. Code Coverage 2/4
  17. 17. Code Coverage 3/4 Requires xdebug, but it’s pretty cool.
  18. 18. Code coverage 4/4 • Takes some time to generate • By default: only files included in test are part of the coverage. • Coverage < Assertions
  19. 19. Plots phploc
  20. 20. Checkstyle
  21. 21. Copy paste detector
  22. 22. PHP Depend
  23. 23. PHP depend, php mess detector etc • Do fancy analysis on your code • Create pretty diagrams • Take a lot of time • Little value (YMMV)
  24. 24. How to set it up
  25. 25. Vagrant • Create and configure lightweight, reproducible, and portable development environments. • Works with VirtualBox and Chef
  26. 26. Vagrant • Allows you create VMs and deploy them with software from a Chef recipe. • Many open source Chef recipes available. • https://github.com/fnichol/chef-jenkins
  27. 27. Vagrantfile config.vm.customize do |vm| vm.memory_size = 1536 end config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.json = { :jenkins => { :server => { :plugins => %w(checkstyle clover dry htmlpublisher jdepend plot pmd violations xunit git github) } } } chef.add_recipe("vagrant_main") end
  28. 28. Chef recipe %w{pdepend/PHP_Depend-beta phpmd/ PHP_PMD-alpha phpunit/phpcpd phpunit/ phploc phpunit/test_helpers PHPDocumentor PHP_CodeSniffer digitalsandwich/Phake phpunit/ PHP_CodeBrowser phpunit/PHPUnit}.each do |pear_package| php_pear pear_package do options "--alldeps" action :install end end
  29. 29. Install PHP specific stuff • Jenkins PHP manual and templates provided by Sebastian Bergmann. • http://jenkins-php.org/
  30. 30. Tell Jenkins what to do • Create build.xml • Lives in your code • Create a Job in Jenkins • Point to your SCM
  31. 31. Configure Jenkins • After running build.xml, lots of XML files are generated. • You can install plugins in Jenkins which understand these XML files • Configure Jenkins plugins to read these files and “publish” them. • Optionally: do some stuff after build succeeds.
  32. 32. Some CI tips
  33. 33. Get fast hardware
  34. 34. Don’t run more than you need • Consider if you want to wait every build on phpmd, pdepend etc. • Alternatively: clone your job and run tests only in one job and analysis in other job.
  35. 35. Use SCM tags • Jenkins can push tags to your SCM if a build succeeds • Combined with tags on deploy very convenient
  36. 36. Make sure production & Jenkins are identical • Different platforms? --> Bugs. • Different PHP versions? --> Bugs. • Different MySQL versions? --> Bugs.
  37. 37. Integrate with your dashboards
  38. 38. Integrate with chat
  39. 39. Q &A willem@mollie.nl
  40. 40. We’re hiring

×