introduction à l'intégration continue en php

100
Introduction à l’intégration continue avec Jenkins PHP Québec Août 2015 Eric Hogue @ehogue erichogue.ca 1

Upload: eric-hogue

Post on 21-Aug-2015

99 views

Category:

Technology


1 download

TRANSCRIPT

Introduction à l’intégration continue avec Jenkins

PHP Québec Août 2015

Eric Hogue@ehogue

erichogue.ca 1

Wikipedia

ensemble de pratiques [...] consistant à vérifier à chaque modification [...] que le résultat des modifications ne produit pas de régression dans l'application développée

http://fr.wikipedia.org/wiki/Int%C3%A9gration_continue

2

Assemblage automatique

3

4

Contrôle automatique

5

Rapide

6

Intégration continue

7

8

Outils

9

10

Moteurs de production (Build Tool)

11

Résultats

12

Rapports

13

Rapports

14

Tendances

15

Extensions

16

Chuck Norris

17

Prêt

18

19

Projet démo

https://github.com/EricHogue/CIPresentation20

21

http://192.168.56.101:8080/

22

23

24

Extensions

● Git● Phing● Green Balls

● ChuckNorris

25

26

27

28

Emplacement du code

29

Quand assembler

30

Moteurs de production

31

Phing

32

<project default="build">

<property name="builddir" value="./build" override="true" />

</project>

build.xml

33

<target name="build" depends="prepare"

description="Build the project">

</target>

build.xml - build target

34

Comment assembler

35

Comment assembler

36

37

Outils PHP

38

39

Composer

40

{

"require-dev": {

"phpunit/phpunit": "4.3.*"

}

}

composer.json

41

42

<target name="phpunit"

depends="prepare">

<exec command="./vendor/bin/phpunit -c phpunitCI.xml" checkreturn="true" />

</target>

build.xml - PHPUnit

43

Échec

44

Publier le rapport PHPUnit

45

Publier le rapport PHPUnit

46

47

48

Publier la couverture du code

49

50

51

52

Tests statiques

53

PHP_CodeSniffer

54

Publier le rapport Checkstyle

55

56

57

58

PHP Depend

59

Publier JDepend

60

61

Classes

62

Couplage

63

Couplage afférent Couplage efférent

Abstraction

AC / TC64

Instabilité

Ce / (Ce + Ca)65

Ca: 0Ce: 3

Ce / (Ce + Ca)3 / (3 + 0) = 1

66

Ca: 3Ce: 0

Ce / (Ce + Ca)0 / (0 + 3) = 0

67

Distance

Idealized line → A + I = 168

Abstraction Instability Chart

69

Overview Pyramid - Héritage

70

Average Number of Derived Classes

Average Hierarchy Height

Overview Pyramid - Grandeur et complexité

71

public function test() {

if ($a) {

...

} elseif ($b) {

...

}

foreach ($c as $d) {

if ($e) {

} else {

}

}

}

1

2

3

4

5

72

Overview Pyramid - Size And Complexity

73

Overview Pyramid - Couplage

74

75

PHP Mess Detector

76

Jeux de règles

77

Publier PMD

78

79

80

81

PHP Copy Paste Detector

82

Publier l’analyse du code dupliqué

83

84

Violations

85

86

87

88

89

Notifications courriel

90

91

Plus de notifications

92

93

Avantages

94

Rétroaction rapide

95

Mesures

96

Automatisation

97

Confiance

98

https://github.com/EricHogue/CIPresentation

Commentaires: https://joind.in/14952twitter: @ehogue

PHP Mentoring: http://phpmentoring.org/

99

● TrafficJam.jpg - Thomanication - https://www.flickr.com/photos/thomanication/6216702247● is_it_worth_the_time.png - xkcd - http://xkcd.com/1205/● LionSelfie.jpg - Silke Remmery - https://www.flickr.com/photos/silkeremmery/15856169578/in/faves-96579472@N07/● RacingDownTheRunway.jpg - Philipp Lücke - https://www.flickr.com/photos/philippluecke/6993495094/in/faves-96579472@N07/● PreciousTreasure.jpg - Dave Sutherland - https://www.flickr.com/photos/raptortheangel/12786162594/in/faves-96579472@N07/● ComputerBug.jpg - Brendan Dolan-Gavitt - https://www.flickr.com/photos/moyix/2352619003/in/faves-96579472@N07/● CatchItIfYouCan.jpg - Tim Mowrer - https://www.flickr.com/photos/mekin/281791343/in/faves-96579472@N07/● CILights.jpg - Jan Krutisch - https://www.flickr.com/photos/jankrutisch/4272142306/in/photostream/● ConductorFrederikMagleConductingASymphonyOrchestra10.jpg - Frederik Magle Music - https://www.flickr.

com/photos/frederikmagle/7026769687/in/photostream/● Ready.jpg - amanda tipton - https://www.flickr.com/photos/demandaj/6789626120● StaticWallpaper.jpg - James Spinks - https://www.flickr.com/photos/realjimbob/13270099● DynamicEarthCME.jpg - NASA Goddard Space Flight Center - https://www.flickr.com/photos/gsfc/7402440272● Containers.jpg - www.GlynLowe.comhttps://www.flickr.com/photos/batega/2056949264 - https://www.flickr.

com/photos/glynlowe/10921733615● MetricMania.jpg - Josep Ma. Rosell - https://www.flickr.com/photos/batega/2056949264● CheaperByTheYard.jpg - Bill Smith - https://www.flickr.com/photos/byzantiumbooks/16173360807● IHateWhenSomeoneLeavesaMessintheBathroom.jpg - e_monk - https://www.flickr.com/photos/e_monk/5931790591● FadeToGrey.jpg - Andreas Levers - https://www.flickr.com/photos/96dpi/2571056264● LCConversion.jpg - Ginny - https://www.flickr.com/photos/ginnerobot/2548843369● NotSoMiniBoot.jpg - Eric E Castro - https://www.flickr.com/photos/ecastro/6195349092● LEGOShip.jpg - Andrey Belenko - https://www.flickr.com/photos/belenko/4295897526● GrungeWarningSignDoNotReadThisSign.jpg - Nicolas Raymond - https://www.flickr.com/photos/80497449@N04/7417352980● Notifications.jpg - Ben Schumin - http://www.flickr.com/photos/schuminweb/9806474636/● MoreBrokenWindows.jpg - brainflakes. - https://www.flickr.com/photos/brainflakes/2763231289● Fragile.jpg - Eye - the world through my I - https://www.flickr.com/photos/ccpixel/● BalancingAct.jpg - Colin Harris ADE - https://www.flickr.com/photos/classblog/5136926303● Escalator.jpg - Adam Lederer - https://www.flickr.com/photos/elmada/2466685791● ZombieWeb.jpg - GollyGforce - Living My Worst Nightmare - https://www.flickr.com/photos/see-through-the-eye-of-g/8218600295● LegoMicroTrophy.jpg - David Luders - https://www.flickr.com/photos/42988571@N08/15965163069● GearWork2.jpg - Curious Expeditions - https://www.flickr.com/photos/curiousexpeditions/489992128● BobTheBuilder.jpg - clement127 - https://www.flickr.com/photos/clement127/15943249419● RulesRulesRules.jpg - Ricardo Liberato - https://www.flickr.com/photos/liberato/2292651755

100