Skip to content

Guides

How to get incremental builds in CI

CI always does a clean build even though your build system supports incremental compilation.

6 min read

CI always does a clean build even though your build system supports incremental compilation.

Why it happens

Every job starts on a fresh machine, so there is no previous build state to be incremental against.

How to fix it

  1. Persist the build output directory keyed on the lockfile
  2. Use a compiler cache so reuse works across branches, not just within one
  3. Consider snapshot runners, which restore the whole machine state
  4. Accept that the first run after a dependency change is always cold

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.