Vous êtes sur la page 1sur 51

Continuous Integration

Todd
Papaioannou
Or,
how to build software
better, faster, cheaper
What??
What is CI?

a development methodology

of daily developer integrations

verified by automated builds


What is it not?

nightly builds

developer branches

scheduled Integration Points

building via IDEs


Continuous
Compilation
!=
Continuous
Integration
‘Fraid Not!
Why do it?
Building software can
be a risky business
Risk 1:
Fixing bugs late is costly

Source: http://www.agitar.com/solutions/ why_unit_testing.html


So why is most
software built Requirements
this way?
Design

Implementation

Testing
Risk 2:
Lack of team cohesion

“Your changes to Bar are incompatible with


mine. How do we merge now?”

“When did we decided to upgrade to version


2.0-alpha of the Super library??”

“I thought you fixed that 2 months ago!”


Risk 3:
Poor quality code base

“We have 3 classes doing the same thing??”

“Everybody knows double checked locking is


a Bad Idea!”

“Why can’t I just include Foo and not require


all of the other 13 libs?”
Risk 4:
Lack of project visibility

“What do you mean the tests are failing?”

“What’s in version 1.2.3 of the build?”

“What’s our code coverage now?


Risk 5:
Lack of deployable software

“It works on my machine!”

“I need a new build to test with”

“The [boss|customer|patron] is coming,


we need to demo progress asap”
Use Continuous
Integration to reduce
the risks
Wait!

Didn’t you say


better, faster,
cheaper?
Better
Build better quality software
That is tested early and often
That adheres to best practices
and coding standards
Faster
Test in parallel, not at the end
No integration points
Builds become a non event
Cheaper
Identify defects earlier
Fix when least costly
Easily repeatable testing
So what
constitutes
a build?
Compilation
!=
A Build
Build Ingredients
Compilation

Test execution

Database integration

Code inspection

Automated deployment

Documentation generation
Compilation

Ensures code actually compiles

On every target platform


Test Execution

Ensures product functions


as expected
Through repeatable testing
DB Integration

Ensures DB and code in sync


Automates (re)creation of
DB and test data
Code Inspections

Ensures a healthy code base


Identifies problems early
Enforces best practices
Automated
Deployment

Products can be released anytime


Continually demo-able state
Eliminates “works on my machine”
Documentation
Generation

Ensures documentation is current


Removes burden from developers
Produces build reports and metrics
How do I
get started?
When do I build?

At every check-in
Every time a dependency changes
Dependency
Graphs Matter!
How do I build?

Use a single build script


That can run from the cmdline
Do not depend on an IDE
Do it continuously

Use a dedicated CI server, not cron


Trigger on all daily check-ins
Not [only] at midnight
Pay attention
to your builds

Provide immediate feedback


Make it easily accessible
Require no developer effort
Metrics Matter

Identify key metrics and


track them visually
Act on them immediately
The 7 step
program
Learn it,
Use it!
Step 1
Commit Early,
Commit Often
Step 2
Never commit
broken code
Step 3
Fix build failures
immediately
Step 4

Fail Fast
Step 5

Act on metrics
Step 6
Build in every
target environment
Step 7
Create artifacts
from every build
print
me!

1. Commit Early, Commit Often


2. Never Commit Broken Code
3. Fix build failures immediately
4. Fail Fast
5. Act on metrics
6. Build in every target environment
7. Create artifacts from every build
Summary
Continuous
Integration

can help you build better


quality software faster,
with more confidence
Start using it!
The End
Roll the Photo Credits
http://www.flickr.com/photos/24263322@N05/2403969648/

http://www.flickr.com/photos/destinme/1267500829/

http://www.flickr.com/photos/legacyalive/891467616/

http://www.flickr.com/photos/tizianoj/1294103746/

http://www.flickr.com/photos/xeophin/2181342710/

http://www.flickr.com/photos/booddin/2190614236

http://www.flickr.com/photos/thomashawk/176219254

http://www.flickr.com/photos/7446536@N03/430561725

http://www.flickr.com/photos/gallerisager/471366272

http://www.flickr.com/photos/mccain007/2092664145

Vous aimerez peut-être aussi