04.7.6 · Skill in Developer experience

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.

Your status · CI quality checks

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

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

  1. Run the fast checks first: format, lint, type check and unit tests. Then the slower ones.
  2. Set a target for CI time at p95, not the average, and measure each step.
  3. Skip work that a change cannot affect: run only the related tests, and reuse cached dependencies when their inputs have not changed.
  4. Track flaky tests. Fix them or set them aside, each with an owner.
  5. Add checks for what reviews miss: security scans, performance budgets, accessibility and broken links.
  6. 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.

Side by side

Shopify's CI before and after the project

BeforeAfter
CI time, p9545 min18 min
Builds that skip some tests45%Over 60%
Test stability88%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 min

    The definitive explanation of continuous integration, recently revised, including what it is not.

Tools

1