CI quality checks
Automated checks that run on every change.
CI checks run tests, linters, type checks, security scans and budgets on every pull request. They catch problems before review. Keeping them fast and reliable matters as much as having them.
Why it matters for a product engineer
CI checks catch problems before review and before users do. But they run on every change, so their speed and reliability set the pace for the whole team. A slow or flaky CI makes people wait, batch their changes, or ignore a red build.
How to do it
- Run the fast checks first: format, lint, type check and unit tests. Then the slower ones.
- Set a target for CI time at p95, not the average, and measure each step.
- Skip work that a change cannot affect: run only the related tests, and reuse cached dependencies when their inputs have not changed.
- Track flaky tests. Fix them or set them aside, each with an owner.
- Add checks for what reviews miss: security scans, performance budgets, accessibility and broken links.
- Make a red main branch the team’s first priority.
Common mistakes
- A check that fails at random, so people run it again without reading it.
- New checks added, while slow or useless ones are never removed.
- Every test on every change.
- Checks that run only after the merge.
Example
Shopify’s core monolith had more than 170,000 tests, and its CI took 45 minutes at p95. The team measured every command and found that 68% of the time went to work before any test ran: preparing machines and building dependencies. They fixed a disk bottleneck that slowed containers. They skipped database migrations when a hash of the migration files had not changed. And they ran only the tests related to each change.
Shopify's CI before and after the project
| Before | After | |
|---|---|---|
| CI time, p95 | 45 min | 18 min |
| Builds that skip some tests | 45% | Over 60% |
| Test stability | 88% | 97% |
Most of the gain came from work CI stopped doing, not from faster tests. Running fewer tests also made the builds more stable.
ReportedChristian Bruckmayer, Shopify, 24 Feb 2021
Sources: Keeping developers happy with a fast CI (Shopify) ↗ · Continuous integration (Martin Fowler) ↗
Resources
1- articleGo deeper
Continuous integration ↗
Martin Fowler · 60 minThe definitive explanation of continuous integration, recently revised, including what it is not.
Tools
1- ToolFreemium
GitHub Actions
CI/CD built into GitHub, for running tests, checks and deployments on every change.