OReilly Integrating PHP Projects with Jenkins (2011).pdf

(5607 KB) Pobierz
Integrating PHP Projects with Jenkins
745242295.003.png
745242295.004.png
Integrating PHP Projects
with Jenkins
Sebastian Bergmann
Beijing Cambridge Farnham Köln Sebastopol Tokyo
745242295.005.png
 
Integrating PHP Projects with Jenkins
by Sebastian Bergmann
Copyright © 2011 Sebastian Bergmann. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles ( http://my.safaribooksonline.com ) . For more information, contact our
corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com .
Editor: Julie Steele
Production Editor: Jasmine Perez
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Integrating PHP Projects with Jenkins , the image of starlings, and related trade dress
are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-30943-5
[LSI]
1315836072
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
1. Build Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The Example Project
2
Our First Build Script
2
2. Setting Up Jenkins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Installing the PHP Quality Assurance Toolchain
5
Installing Jenkins
6
3. Continuous Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Running Unit Tests During the Build
11
Creating a Jenkins Job
14
4. Continuous Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
API Documentation
21
Software Metrics
22
Duplicate Code
24
Coding Standard Violations
26
Result Aggregation
29
Complete Build Script
30
5. Automating the Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
PHP Project Wizard
33
Template for Jenkins Jobs for PHP Projects
35
6. Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Continuous Integration and Development Branches
37
Additional Testing
38
Continuous Deployment
40
iii
745242295.001.png 745242295.002.png
Zgłoś jeśli naruszono regulamin