Continuous Integration
The engineering practice of merging code changes into a shared mainline many times a day and verifying each merge with automated builds and tests.
Definition
Continuous Integration (CI) is the engineering discipline of integrating code from every developer into a shared mainline frequently — multiple times per day per developer — and verifying each integration with an automated pipeline of build, lint, unit tests, integration tests, and security scans. The term predates DevOps; Grady Booch coined it in 1991, and Martin Fowler popularised it in his 2006 essay. CI is the foundation on which Continuous Delivery and Continuous Deployment sit; without it, neither works.
Why It Matters
I have seen the same pattern repeatedly. A team works on long-lived feature branches "to avoid breaking main". Six weeks later, the merge takes three days, breaks the test suite for a week, and ships with three subtle regressions because no individual developer can hold the full diff in their head. The team concludes that integration is dangerous. The actual lesson is the opposite: integration is dangerous precisely because they didn't do it often enough. CI inverts the problem — small, frequent, automated merges are nearly always safe.
What a Real CI Pipeline Looks Like
- Developer pushes a branch.
- Pipeline runs lint, format, type-check (under 1 minute).
- Unit tests run (under 5 minutes).
- Integration tests run on a real DB and dependency stubs (5–15 minutes).
- Security and dependency scans run.
- If green, the PR can be merged; merge triggers a deploy to staging.
- Staging smoke tests run automatically.
- Trunk is always shippable.
Real-World Example
A 30-engineer platform team moved from weekly branch merges to trunk-based CI over two quarters. Pre-CI: average integration pain 4 hours per merge, 28 production incidents per quarter, deployment cadence weekly. Post-CI: average merge time under 30 minutes, 6 production incidents per quarter, deployment cadence ~14× per day. The engineering investment was two senior engineers for one quarter rebuilding the pipeline. ROI inside six months was difficult to argue with.
Practical Lessons Learned
- Short-lived branches are non-negotiable. If your branches live longer than 24 hours, you don't have CI; you have batched delivery with extra steps.
- Pipeline speed is a feature. A 45-minute pipeline kills CI; engineers context-switch and merge less often. Aim for under 10 minutes to PR-green.
- A broken build is a stop-the-line event. Toyota-style. Whoever broke it fixes it before starting anything else.
- Feature flags decouple deploy from release. You can merge incomplete features behind a flag and ship safely.
- Flaky tests destroy CI faster than anything else. Quarantine them aggressively; fix or delete.
Common Mistakes
- "CI" that runs only on PR open, then never again. CI runs on every push, every merge, every nightly.
- Long-lived feature branches. Defeats the entire purpose.
- Tolerating a red main. Once main is broken, everyone's pipeline is meaningless.
- Ignoring flaky tests. They train the team to ignore real failures.
- Tests that hit external services without isolation. Network flakiness becomes test flakiness.
- No deployment gating. CI without automated deploy to at least staging gives you fast feedback but loses the safety net.
Expert Tips
- Measure pipeline duration as a KPI. Treat speed regressions like product regressions.
- Cache aggressively but invalidate correctly. A stale cache is worse than a slow build.
- Run unit tests first, expensive tests later. Fail fast on the cheap signals.
- Pair CI with Definition of Done. Pipeline-green is part of DoD; DoD enforces what CI verifies.
- Use trunk-based development as the natural endpoint of CI maturity.
Key Takeaways
- Continuous Integration means merging frequently to a shared mainline with automated verification on every merge.
- The discipline of frequent small integration is what makes integration safe; long-lived branches are the danger.
- Pipeline speed and reliability are first-class product concerns.
- Flaky tests and tolerated red builds are the two cultural failures that kill CI.
- CI is the prerequisite for Continuous Delivery and Continuous Deployment, not a substitute for them.
Related Encyclopedia Entries
- Definition of Done
- Agile Project Management
- Kanban
- WIP Limits
- Quality Management
- Sprint Retrospective
Related Research Articles, Case Studies & Tools
Frequently Asked Questions
Is CI the same as CD?
No. CI is integration with automated verification. CD (Continuous Delivery) extends CI with automated deployment to staging; Continuous Deployment goes further by deploying to production automatically on green.How often should developers merge?
At least once a day per developer, ideally several times. Branches living longer than 24 hours are an antipattern.What's a reasonable pipeline duration?
Under 10 minutes for PR-green is healthy. Beyond 15 minutes, developers context-switch and stop merging frequently.How do we handle flaky tests?
Quarantine them in a separate suite, fix within a sprint, or delete. Tolerating flakes destroys signal.Do we need feature flags?
For trunk-based CI on a real product, yes. Flags decouple deployment from release and let you merge incomplete work safely.Does CI work for legacy systems?
Yes, but the path is longer. Start with a green build on the existing test suite; add tests around the change frontier; increase frequency gradually.What metrics matter?
DORA: deployment frequency, lead time for changes, change failure rate, mean time to restore. Together they tell you whether CI is doing its job.What is a common misconception about Continuous Integration?
That the topic is well-defined across all references. In practice, definitions vary between PMBOK, PRINCE2, AACE and ISO 21500 — this entry uses the definition most aligned with field practice on capital projects, and flags where the standards diverge.Which related encyclopedia entries should I read alongside Continuous Integration?
Read Earned Value Management, Critical Path Method and the DCMA 14-point assessment next. The full A–Z is available in the PMMilestone Encyclopedia, and quick one-line definitions live in the PM Glossary on the flagship platform.How does Dr. Hassan Eliwa's research treat Continuous Integration?
Dr. Hassan Eliwa's research focuses on owner-side project controls, schedule integrity and forensic delay analysis on capital construction and power programmes. Continuous Integration is treated through that lens — what a planning or controls engineer is expected to do with it on a live project, not its textbook definition alone. See the full research library at PMMilestone Research Articles.How is Continuous Integration defined on PMMilestone Research & Insights?
The engineering practice of merging code changes into a shared mainline many times a day and verifying each merge with automated builds and tests. For the full treatment, see the definition, principles, applications and related entries above — every encyclopedia entry follows the same research-grade structure.
People also ask
Follow-up questions practitioners search for next — each one points to the calculator, template or reference entry that answers it.
Which learning track covers this end-to-end?
Structured tracks from beginner planner to programme controls director. Project Controls Academy ↗
Which book goes deeper than this entry?
Practitioner field handbooks with worked numerical examples. Books & Publications ↗
Which calculator on PMMilestone.org applies here?
The integrated EVM workbook covers most cost-schedule diagnostics. EVM Calculator ↗
Where is this in the glossary?
Quick-lookup definitions across 1,200+ PM terms. PM Glossary on PMMilestone.org ↗
Related Entries
Further reading on PMMilestone.org
Curated companion resources hosted on the flagship platform, PMMilestone.org.
- For practitioners who want to go deeper, the Project Controls Academy.
- Engineers researching this topic typically continue with the Learning Tracks.
- A practical companion to this entry is the Books & Publications.
- Closely related on the flagship platform is the EVM Calculator.
- Useful alongside this article is the Schedule Health Checker.
- Many readers follow this up with the PMMilestone.org knowledge hub.