47
Sebastian Marek, Software Architect Podróż w krainę Continuous Integration

Podróż w krainę Continuous Integration

Embed Size (px)

DESCRIPTION

Over the past two years we’ve been pushing to improve our automated testing practices within Plusnet and to win full support for it within the company across the spectrum of fellow developers, project managers and upper management. It took a while to agree on software we want to use, and standards we want to follow, but now all new code is being continuously built and tested and the results of that are visible business-wide. We use PHP_CodeSniffer to verify that we follow our coding standards, PHPDocumentor to generate automated API documentation, PHPUnit to run test suites and phpUnderControl to run all these tools regulary, at least once a day and to generate aggregated reports. Finally, Sonar allows us to create and publish reports visible to everybody and more importantly reports that everybody can understand. Setting it all up can be a tough exercise, but if you prepare to it upfront you might actually find it quite exciting! So, you strongly believe this is the way you should be developing your code, but you don’t really know where to start? Let me show you how our journey began. You don’t know how to convince your fellow developers to follow you? I’ll tell you how to establish a strong team that will follow you. Your managers seem to be more interested in delivering your project on time and don’t really see a point in spending additional time on unit testing and documenting your code? Maybe you haven’t shown them the benefits of continuous integration in a way they can understand. I’ll show you what worked for us.

Citation preview

Page 1: Podróż w krainę  Continuous Integration

Sebastian Marek, Software Architect

Podróż w krainę Continuous Integration

Page 2: Podróż w krainę  Continuous Integration

@proofek

10 lat doświadczenia w PHP

współautor 2 książek o tematyce PHP

zwolennik automatyzacji procesów

TDD i CI

Page 3: Podróż w krainę  Continuous Integration

Dawno dawno temu

Page 4: Podróż w krainę  Continuous Integration

U stóp Góry Przeznaczenia

coraz dłuższy czas utrzymania

wzrastająca liczba problemów

mało zrozumiały i mało przejrzysty kod

skomplikowane i czasochłonne testowanie

Page 5: Podróż w krainę  Continuous Integration

Szukanie pomocy!

Page 6: Podróż w krainę  Continuous Integration

Pierwsze frustracje

sporadyczne “buildy” mieszanka php3 i php4 nauka w locie brak standardów

Page 7: Podróż w krainę  Continuous Integration

Tworzenie drużyny

Stuart Grimshaw Simon Westcott Ben Selby Sebastian Marek Rowan Merewood Ben Longden

Page 8: Podróż w krainę  Continuous Integration

Zwołanie rady

Kto? menadżerowie programiści

O czym? zagrożenia szanse plan wdrożenie

http://www.flickr.com/photos/pedromourapinheiro/3272323691/in/photostream/

Page 9: Podróż w krainę  Continuous Integration

Jak nie wiadomo o co chodzi to chodzi o pieniądze

Design debt Karne opłaty Odsetki

http://www.flickr.com/photos/your_teacher/1040476355/in/photostream/

Page 10: Podróż w krainę  Continuous Integration

Najlepsze rozwiązanie

VS.

Page 11: Podróż w krainę  Continuous Integration

Wsparcie i plan rozwoju

http://www.flickr.com/photos/jannem/3312115991/in/photostream/

Page 12: Podróż w krainę  Continuous Integration

Raporty i statystyki

http://www.flickr.com/photos/aussiegall/286709039/in/photostream/

Page 13: Podróż w krainę  Continuous Integration

Łączenie sił z mocniejszymi sojusznikami

Page 14: Podróż w krainę  Continuous Integration

Automatyzacja

http://www.flickr.com/photos/matthileo/3552898254/in/photostream/

Page 15: Podróż w krainę  Continuous Integration

Front wschodni

Page 16: Podróż w krainę  Continuous Integration

Zautomatyzowane buildy

wtyczka do Cruisecontrol wsparcie dla PHPUnit Intergracja z

phpDocumentor generowanie statystyk

kodu Raport code coverage Integracja z raportem

checkstyle Integracja z PHP Depend Integracja z PHPMD i wiele wiele więcej

Page 17: Podróż w krainę  Continuous Integration

PHPUnit

Najpopularniejsze narzędzie do unit testów oparte na standardzie xUnit, ze wsparciem dla: mock obiektów testów bazodanowych (dbUnit) raportów “code coverage” selenium RC platform continuous integration, takich jak CruiseControl,

Hudson, Bamboo

Page 18: Podróż w krainę  Continuous Integration

phpDocumentor

zautomatyzowane tworzenie dokumentacji dla PHP

wsparcie dla: HTML, PDF, CHM, XML

interfejs CLI i poprzez przeglądarkę internetową

łatwo konfigurowalny

Page 19: Podróż w krainę  Continuous Integration

PHP_Codesniffer

Oparty na predefiniowanych standardach kodowania Wykrywa niezgodności ze standardami kodowania W pełni konfigurowalny z możliwością definiowania

własnych standardów Codebrowser

Page 20: Podróż w krainę  Continuous Integration

Raport “code coverage”

Świadomość ilości przetestowanego kodu Procentowe przedstawienie pokrycia kodu testami Konfigurowalne przedziały akceptowalności Format clover Format HTML

Page 21: Podróż w krainę  Continuous Integration

Statystyki - PHP Depend

Statystyki: Cyclomatic Complexity NPath Complexity CodeRank Lines Of Code

Page 22: Podróż w krainę  Continuous Integration

PHP Mess Detector

Inteligentna analiza kodu: Potencjalne problemy Niezoptymalizowany kod Zbyt skomplikowane

operacje Nieużywane parametry,

metody, właściwości

Page 23: Podróż w krainę  Continuous Integration

phpUnderControl

Page 24: Podróż w krainę  Continuous Integration

Buildbox na co dzień

Rosnąca ilość nowych modułów Wydłużony czas budowania Częste zawieszenia Problemy ze stabilnością Problemy ze sprzętem

Page 25: Podróż w krainę  Continuous Integration

Potrzeba udoskonalenia

Page 26: Podróż w krainę  Continuous Integration

Hudson/Jenkins – następny krok

Łatwa instalacja Łatwa konfiguracja Wsparcie dla wtyczek Rozproszone “buildy” Internacjonalizacja

Page 27: Podróż w krainę  Continuous Integration

Hudson/Jenkins

Page 28: Podróż w krainę  Continuous Integration

Selenium

Automatyczne testy aplikacji internetowych

Page 29: Podróż w krainę  Continuous Integration

Władca pierścieni

http://www.flickr.com/photos/cosmic_bandita/2218419160/in/photostream/

Page 30: Podróż w krainę  Continuous Integration

Front zachodni

Page 31: Podróż w krainę  Continuous Integration

Sonar

Page 32: Podróż w krainę  Continuous Integration

Sonar

Platforma do zarządzania jakością kodu

Nieustanna analiza kodu Łatwy w konfiguracji Wsparcie dla wtyczek

Page 33: Podróż w krainę  Continuous Integration

Raporty dostępne dla wszystkich

Łatwo zrozumiałe raporty i statystyki Definicja celów Odpowiedzialność

Page 34: Podróż w krainę  Continuous Integration

Widok typu radiator

Page 35: Podróż w krainę  Continuous Integration

Raporty

Page 36: Podróż w krainę  Continuous Integration

Raporty

Page 37: Podróż w krainę  Continuous Integration

Raporty

Page 38: Podróż w krainę  Continuous Integration

Raporty

Page 39: Podróż w krainę  Continuous Integration

Raporty

Page 40: Podróż w krainę  Continuous Integration

Armia musi podążać za przywódcą

Idź za przykładem Bądź stanowczy, ale jednocześnie przyjazny i pomocny Szkolenia Proste i zrozumiałe reguły/standardy Kij i marchewka

Page 41: Podróż w krainę  Continuous Integration

You broke the build!

Page 42: Podróż w krainę  Continuous Integration

Where's the build?

Page 43: Podróż w krainę  Continuous Integration

Works on my machine?!

Page 44: Podróż w krainę  Continuous Integration

Czas na ciebie!

Page 45: Podróż w krainę  Continuous Integration

Podsumowanie

1. Rozpoznanie

2. Próba

3. Odpowiedni zespół

4. Powoli, małymi krokami

5. Bądź widoczny

6. Automatyzacja

Page 46: Podróż w krainę  Continuous Integration

Źródła

PHPUnit - http://www.phpunit.de/ phpUnderControl - http://phpundercontrol.org/ Jenkins - http://jenkins-ci.org/ Sonar - http://www.sonarsource.org/ phpDocumentor - http://www.phpdoc.org/ PHP_CodeSniffer -

http://pear.php.net/package/PHP_CodeSniffer/ PHP Depend - http://pdepend.org/ PHP Mess Detector - http://phpmd.org/ Selenium - http://seleniumhq.org/ xDebug - http://www.xdebug.org/

Page 47: Podróż w krainę  Continuous Integration

Pytania

Pytania?

http://joind.in/3199