Continuous integration

From Wikipedia, the free encyclopedia

Continuous integration describes a set of software engineering practices that speed up the delivery of software by decreasing integration times. It emerged in the Extreme Programming (XP) community, and XP advocates Martin Fowler and Kent Beck first wrote about continuous integration near the turn of the millennium. Fowler's paper[1] is a popular source of information on the subject. Beck's book Extreme Programming Explained (1999, ISBN 0-201-61641-6), the original reference for Extreme Programming, also describes the term.

Contents

[edit] The Practices

Although these practices existed before, extreme programming practitioners recommend that teams require their developers to continuously integrate.

[edit] Maintain a code repository

This practice advocates the use of a revision control system for the project's source code. All artifacts that are needed to build the project should be placed in the repository. In this practice and in the revision control community, the convention is that the system should be buildable from a fresh checkout and not require additional dependencies. Fowler also mentions that where branching is supported by tools, its use should be minimised. Instead, it is preferred that changes are integrated rather than creating multiple versions of the software that are maintained simultaneously. The mainline (or trunk) should be the place for the working version of the software.

[edit] Automate the build

The system should be buildable using a single command. Many build tools exist, such as make, which has existed for many years. Other more recent tools like Ant or MSBuild are frequently used in Continuous Integration environments. Automation of the build should include automating the integration, which often includes deployment into a production-like environment. In many cases, the build script not only compiles binaries, but also generates documentation, website pages, statistics and distribution media (such as Windows MSI files or RPM files).

[edit] Make your build self-testing

This touches on another aspect of Extreme programming: Test-driven development. The system should be written with tests that verify that it performs as intended. These tests should be run as part of the build. Automated tests are increasingly valuable as the system ages.

[edit] Everyone commits every day

By committing regularly, every committer can reduce the number of conflicting changes. Checking in weeks worth of work runs the risk of conflicting with other features and can be very difficult to solve. Early, small conflicts in an area of the system cause team members to communicate about the change they are making.

[edit] Every commit (to mainline) should be built

Commits to the current working version should be built to verify they have been integrated correctly. A common practice is to use Automated Continuous Integration, although this may be done manually. In fact, some prefer this approach. For many, continuous integration is synonymous with using Automated Continuous Integration where a continuous integration server or daemon monitors the version control system for changes, then automatically runs the build process.

[edit] Keep the build fast

The build needs to be fast, so that if there is a problem with integration, it is quickly identified.

[edit] Test in a clone of the production environment

Having a test environment can lead to failures in tested systems when they are deployed to the production environment, because the production environment may differ from the test environment in a significant way.

[edit] Make it easy to get the latest deliverables

Making builds readily available to stakeholders and testers can reduce the amount of rework necessary when rebuilding a feature that doesn't meet requirements. Additionally, early testing reduces the chances that defects survive until deployment. Finding issues earlier also, in some cases, reduces the amount of work necessary to resolve them.

[edit] Everyone can see the results of the latest build

It should be easy to find out whether the build is broken and who made the change.

[edit] Automate Deployment

[edit] Advantages

Continuous integration has many advantages:

  • When unit tests fail, or a bug is discovered, developers might revert the codebase back to a bug-free state, without wasting time debugging.
  • Integration problems are detected and fixed continuously - no last minute hiatus before release dates;
  • Early warning of broken/incompatible code;
  • Early warning of conflicting changes;
  • Immediate unit testing of all changes;
  • Constant availability of a "current" build for testing, demo, or release purposes;
  • The immediate impact of checking in incomplete or broken code acts as an incentive to developers to learn to work more incrementally with shorter feedback cycles.

[edit] Software

Notable examples of continuous integration software include:

[edit] See also

[edit] Further reading

  • Duvall, Paul M. (2007). Continuous Integration. Improving Software Quality and Reducing Risk. Addison-Wesley. 0-321-33638-0. 

[edit] References

  1. ^ FOWLER, Martin. Continuous Integration.

[edit] External links