Tanti "piccoli rilasci" con Symfony2

31
@morafabio Tanti “Piccoli Rilasci” con Symfony2 10 ottobre 2014 - SymfonyDay, Milano

description

Una user story non è completa finché non è nelle mani di chi la deve usare. Solo da lì inizia a produrre valore, sia esso economico o sia feedback. Che si tratti di master, preview o production, con l’automazione delle build si possono evitare operazioni ripetitive, complesse, risparmiare tempo, ottenere interessanti metriche sul codice, tutto al fine di arrivare a poter rilasciare ogni poche ore (o, se volete, ogni volta che la build è verde!). Farlo in modo frequente è possibile anche con Symfony2. Mettiamo in pratica con un esempio una delle 12 pratiche di Extreme Programming: continuous delivery e integration tra git, bash, Jenkins e strumenti deploy.

Transcript of Tanti "piccoli rilasci" con Symfony2

  • 1. Tanti Piccoli Rilasci con Symfony2 ! 10 ottobre 2014 - SymfonyDay, Milano @morafabio
  • 2. Chi sono @morafabio 2 1990 Fabio Mora 2001 Linux User Group gallug.it 2008 Software Engineer freelance 2010 Prima SRL 2011 GrUSP, IAD 2013 Studente di Economia 2014 eBay
  • 3. una user story non completa finch non nelle mani di chi la deve usare 3
  • 4. http://symfony.com/it/doc/current/cookbook/deployment/tools.html 4
  • 5. Quanto costa cambiare una singola riga di codice in produzione? 5
  • 6. Processi complessi? manual manual manual manual @morafabio 6 develop integrate build QA deploy smoke check merge regression PR test metrics docs changelog package notify go live! KPI stories code test build git push focus n * dev * n * progetti = !!!
  • 7. A lazy programmer is a good programmer 7 Larry Wall
  • 8. 8
  • 9. Automatizziamo! @morafabio 9 one-click auto auto auto auto develop integrate build QA deploy Continuos Integration Continuos Delivery
  • 10. Premesse @morafabio 10 Version Control System (git) Test coverage (unit, integration, functional, e2e) Avere un host da dedicare a C.I. Integrare almeno una volta al giorno Prima di integrare, eseguire una build locale
  • 11. 1. Una build di Symfony2 @morafabio 11 Cleanup Composer Lint check parameters.yml Bower, grunt, sprites Security check Doctrine Migrations Fixture Assetic phpunit -c app/ build.xml targets ant build
  • 12. ant composer ant test 12
  • 13. ant doctrine-setup 13
  • 14. 2. Jenkins C.I. Check safety delle pull-request Build (parametrizzate) Testing, smoke, regression Metriche, docs, changelog Trigger post build (es. deploy) Notifiche (mail, push) tons of plugins! apt-get install jenkins wget http://localhost:8080/jnlpJars/jenkins-cli.jar java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin [plugins] @morafabio 14 web interface
  • 15. 15
  • 16. 2 @morafabio 16 Setup di un task
  • 17. Possibile scenario Symfony2 su Jenkins Test xUnit, Clover PHP Metrics http://jenkins-php.org/ 17 SCM Git, GitHub Utility GreenBalls, Workspace Cleanup, HTMLPublisher CheckStyle, DRY, PMD, Violations
  • 18. 3. Deploy swiss-knife @morafabio Usa capistrano (rails) Collezione di recipes Operazioni su cluster Multistage extension 18 app/config/deploy.rb gem install capifony capifony .
  • 19. app/config/deploy.rb 19
  • 20. cap deploy:setup cap deploy cap deploy:rollback 20
  • 21. MOAR MOAR! cap -vT 21 cap -vT | wc -l 83
  • 22. Lezione imparata! Le cose che avrei voluto sapere prima 22
  • 23. Tips & Tricks @morafabio 23 PHPUnit @group No-CI e CI Cancellare il workspace allinizio, non alla fine Usare Satis (ed altri repo locali) Usare DNS locali Jenkins sandbox: attenzione ai processi esterni Git tag ad ogni deploy Cancellare la cache di APC dopo il deploy Green Balls plugin per Jenkins bash = triforce!
  • 24. Testing end to end in buildhost @morafabio 24 facebook/php-webdriver Selenium Xfvb Jenkins https://github.com/morafabio/headless-selenium
  • 25. Visual Feedback @morafabio 25 + http://jenkins.ci/api/json
  • 26. Visual Feedback @morafabio 26 + http://jenkins.ci/api/json
  • 27. 27 Extreme Programming Explained / 2nd Ed. Beck, Andres - Addison Wesley Bohem, Beck
  • 28. planning game, small releases, metaphor, simple design, testing, refactoring, pair programming, collecting ownership, continuos integration, 40 hours/week, customer on site, coding standards, whole team 28
  • 29. Travis CI, wercker, Circle CI Go, Cruise Control, Idephix Maven, Phing, capistrano, grunt 29 MOAR tools! MOAR books!
  • 30. Grazie! [email protected] facebook.com/fabio.mm @morafabio 30
  • 31. Domande? Feedback https://joind.in/event/sfdayit-14 Codice https://github.com/morafabio/symfony-ci [email protected] facebook.com/fabio.mm @morafabio 31