Operations · Operations & process management
Continuous integration
Best for Early Startup to Startup
Use it when
Merging code between developers keeps breaking the build or takes days, and you need every change built and tested on the shared mainline at least daily.
Skip it when
- You also want every passing build released to production automatically. Use Continuous integration/continuous deployment (CI/CD), which builds on this practice.
- The code gets occasional contributions from people outside a committed full-time team. Feature branches with reviewed pull requests suit that pattern better.
What to apply first and what to use instead are listed below.
Approaches
Direct commits with pairing
Developers push small commits straight to the mainline, and pair or mob programming supplies the review before each push.
- Pro Nothing waits for review, so code reaches the mainline within hours.
- Con It depends on pairing habits and a strong test suite, since no review gate sits before the push.
Short-lived branches with pull requests
Each change sits on a branch that lives less than a day and merges through a reviewed pull request.
- Pro Every change gets a recorded review before it reaches the mainline.
- Con Review waits can stretch from minutes to days, which delays integration and invites bigger batches.
Inputs
- Shared mainlineOne branch in version control holding everything needed to build and configure the product.
- Build scriptOne command that compiles, packages and runs the tests from a clean checkout.
- Automated testsFast unit tests plus a handful of acceptance tests on the highest-value features, kept in the repository.
- CI serviceA build server or hosted service that can build every push to the mainline and post results to team chat.
- Current baselineOptionalBranch ages, merge frequency and build times for the last month, from the repository and any existing build server.
Steps
- Put everything the build needs into the mainline, and script the build so one command builds and tests from a clean checkout.
- Set the CI service to build and test every push to the mainline and post each result to the team chat.
- Agree that every developer merges to the mainline at least once a day, hiding unfinished work behind feature flags or branch by abstraction.
- Keep the commit build under about ten minutes by moving slower tests into a later pipeline stage or running them in parallel.
- Adopt a rule that a broken mainline build is fixed or the change reverted before anyone pushes other work.
- Review the CI measures weekly and fix the slowest or least reliable part of the build.
Output
A running CI setup with a short written team agreement and a weekly measures table.
- Merges to mainline per developer per day
- Share of commits built and tested without manual steps
- Commit build time
- Daily build success rate
- Time from broken build to fix or revert
- Active branches and their age
Done when
- A clean checkout builds and tests with one command.
- Every push to the mainline triggers a build and tests with no manual step.
- Repository history shows each developer merging to the mainline at least daily.
- The commit build finishes in about ten minutes or less.
- The fix-or-revert rule is written down, and recovery time is recorded for every broken build.
Measure
Review the measures weekly for the first two months, then monthly, against your own figures from before the change. It worked when branches live less than a day, broken builds are recovered faster than in your baseline, and fewer integration problems surface late in a release. Treat a steady rise in build time as a signal to split or parallelize the tests.
Hypothetical example
Tallow, an eight-person payroll software team, merged feature branches every one to two weeks and spent two days per release fixing merge conflicts. They scripted the build, set their CI service to run on every push, and agreed to merge daily behind feature flags. The first commit build took 25 minutes, so they moved database tests to a second stage, bringing it to 8 minutes. After six weeks, branches averaged under a day old, 94 percent of daily builds passed, and release merge fixes took about an hour.
Common mistakes
- Running a build server on long-lived feature branches and calling it CI. Merge to the mainline at least daily.
- Leaving the mainline broken while people keep pushing. Revert the change that broke it, then fix it calmly.
- Letting the build grow slow until people stop waiting for it. Move slow tests to a later stage and run tests in parallel.
Sources
- Continuous Integration · Martin Fowler, 2024
- Capabilities, continuous integration · DORA
By company stage
Apply first
Nothing. You can start here.
Use instead
- Continuous integration/continuous deployment (CI/CD)
You also want every passing build released to production automatically. Use Continuous integration/continuous deployment (CI/CD), which builds on this practice.
Where it sits
Open the operations & process management roadmapRecommended resources
No sponsored resources on this framework yet. Sponsored listings would be labelled here, never in search.
Progress is not saved until you have an account. Create a free account