AI coding has made CI a bottleneck, so we reworked ours to keep up
Article URL: https://linear.app/now/ci-bottleneck-reworked Comments URL: https://news.ycombinator.com/item?id=49792067 Points: 260 # Comments: 298
In recent months, Linear's chief technology officer, Tuomas, pointed out that the company's continuous integration (CI) process was becoming a bottleneck as development accelerated. While faster code shipping through agents had occurred, validating those changes remained slow. As a result, CI became a bottleneck, increasing infrastructure costs and delaying developers and agents' feedback.
Linear sought to optimize CI performance by focusing on two key metrics: the time a pull request waited on CI and the runner time consumed by each test. Despite test suites quadrupling since the start of the year, they managed to reduce pull request wait time from over 6 minutes to just over 5 minutes, and halved runner time per test.
The optimizations primarily applied across languages and toolchains, as Linear's codebase is primarily TypeScript. One early optimization involved moving workloads off GitHub Actions to third-party runners with faster CPUs, higher-performance storage, and better cache infrastructure, resulting in a 34% faster average job execution, with some workloads seeing a 52% improvement.
Switching to tsgo, the native TypeScript compiler, also reduced the weekly median of the tsc check by 73%. Linting was another priority, with custom lint rules relying on TypeScript type information slowing down the process. Rewriting these rules to use static analysis over the abstract syntax tree eliminated the need for TypeScript, reducing API lint time by 68% and full-repository lint time by 55%.
Memory usage also decreased as a result of this change, making it easier to transition to Oxlint later. The analysis of CI as a system revealed that small jobs preceding the main checks played a significant role in delays. Change-detection jobs, for example, needed to check all paths touched by a PR, causing unnecessary checks and delays.
By capping fetch depth and removing unnecessary checkouts, Linear reduced the slowest gate from 94 seconds to 20 seconds and eliminated checkout entirely from jobs that didn't require a working tree, cutting time spent on those from 27 seconds to 7 seconds. Replacing actions/checkout with a custom action that retried with backoff and used a checkout cache also helped avoid hangs caused by intermittent network degradation.
Additionally, moving cache marker writing to a job that runs after test shards finish but gates nothing shaved 42 seconds from the merge path for every API pull request and merge-queue entry. These changes collectively reduced the check time for API pull requests on cache misses by roughly a minute, while also reducing runner starts.
Finally, Linear optimized the setup cost repeated across every job by moving common installations into a small CI base image, shortening the tail and improving overall CI performance.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.