AI Briefing
KO

FE Core Team's CI Speed Battle: Optimizing Parallel Builds with Cache Strategy

·2025.06.11 00:00

Key point

Matrix parallelization and pre-checking cache status reduced monorepo CI time by up to 84%.

1 / 2

Details

The FE Core team operates around 30 Next.js apps in a turborepo-based monorepo, dealing with an environment where frequent merges to main and changes to pnpm-lock.yaml required build and stability verification for all projects. A remote cache server and dorny/paths-filter@v3 reduced unnecessary builds, but on cache misses the entire CI took over 20 minutes, and when multiple workflows overlapped it stretched to over 30 minutes, even causing interruption errors.

First, they increased the memory and core count of the Ubuntu Runner, reducing overall execution time from the 20-minute range to the 10-minute range. However, the underlying structure of sequentially building 30 projects in a single process remained a bottleneck, so they shifted direction by introducing GitHub Actions Matrix to run per-project builds in parallel.

The effect of applying Matrix varied depending on the situation.

  • On cache miss: improved from 10m27s → 8m6s
  • On cache hit: worsened from 1m14s → 6m57s

In other words, parallelization helped when there was no cache, but it revealed a problem where overhead increased when the cache matched well.

To solve this problem, they used turborepo dry-run to check cache status in advance. After using turbo run build --dry-run to check the cache status of all packages, they restructured it into a branching logic where builds are skipped if all packages are cached, and only cache-missed packages are targeted for Matrix execution.

The results were more stable.

  • On cache miss: further reduced from 10m27s → 5m29s
  • On cache hit: overhead minimized from 1m14s → 1m11s

Finally, to manage the individual build results distributed via Matrix as a single status in the branch protection policy, they separated out a build verification step. Ultimately, by combining Runner spec improvements, Matrix parallel builds, cache pre-checking, and verification step separation, they reduced the overall CI pipeline time by up to 84%, achieving a reduction from the 30-minute range to the 5-minute range on build misses.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.