continuous integration

21
Continuous Integration Better building

Upload: robertjoelwatts

Post on 25-Jun-2015

278 views

Category:

Documents


0 download

DESCRIPTION

An introduction to CI concepts

TRANSCRIPT

Continuous IntegrationBetter building

What is Continuous Integration?

CI is a software development practice invented to:

Ease integration

Self test builds

Reduce bug build up

Increase automation

Give greater project state visibility

Allow developers to concentrate on coding

How is this achieved?

It’s achieved by continually integrating

(in other words checking in with the main branch frequently)

and then having every integration verified

by automatically kicking off a tested build

What’s the benefit?

Avoiding late bugs

By integrating continually you know about more bugs in code ahead of time rather than just before release

Creating a more cohesive team

Everybody integrates with everyone else frequently

Avoid development ‘islands’

Know about merging difficulties ahead of time

Avoid people saying “When did we decide to upgrade that jar to 2.0-

alpha pre-release?” “I thought you fixed that months ago”

Enhancing project visibility

Everyone (even non-developers!) can see the state of a project at any given time; now or in the past

Generated reports for projects for things such as code test coverage, code style/warnings, change logs, bug checking etc

Know what made (and broke!) a particular version of a deployed release

Create deployable software

Software should, as much as possible, work

CI helps developers keep their software deployable

Which keeps release cycles short

Which is good for business

Stops “Well, it works on my machine”

Create better software

Code is tested early and often

Reports can show progress in meeting coding standards

Test are done in parallel, not at the end

No integration points

Builds become a no-brainer

Defects are identified earlier

Defects are fixed when less costly

Easily repeatable testing

This is the cool dude that came up with it: Martin Fowler

http://www.martinfowler.com/articles/continuousIntegration.html

Martin Fowler’s 10 Principles of CI

Maintain a single source repository

Automate the build

Make your build self testing

Everyone commits all day, every day

Every commit is built

Martin Fowler’s Principles cont…

Keep the build fast

Test in a clone of the production environment

Make it easy for anyone to get the latest executable

Everyone can see what is happening

Automate deployment

Maintaining a Single Source Repository

A version control repository has to include ALL needed sources to build And nothing else CVS, SVN, Git, etc…

Issue: external dependencies Keep in repository, or Dependency management with repository of

referenced binaries, e.g. maven, ivy

Hang on, what’s in a build?

When to do a build

At every check-in Not simply over night!

Whenever a dependency changes

How to do a build

Using a single build script

Could use Ant Maven Make …

Should be able to be run from the command line

Should have no external dependency such as an IDE

When the build fails…

Make sure it fails fast

Fix it immediately!

The world will continue to turn

Code inspections

Test coverage tools reports highlight where to focus testing efforts Clover Cobertura

Static Analysis tools read source code to check for best practices and identify weak spots Checkstyle Findbugs

CI helps you track these over time

Metrics can be established to ensure quality

Generating documentation

CI can automatically generate documentation for every build

Ensuring it is always current

Removes the burden from developers

Code inspection reports add to documentation

CI Mantra

That’s it really