What are the tips for passing Lighthouse thresholds in a CI/CD pipeline?
Author: Yılmaz Saraçlighthouse-ciperformans-butcesici-cdregresyon
Short answer: Passing Lighthouse thresholds in CI/CD reliably is about controlling variance and defining per-metric budgets, not chasing a single overall score.
Practical tips
- Use Lighthouse CI and run each audit at least three times, taking the median; a single run is noisy.
- Assert on individual metrics: LCP, CLS, total bytes, script size, rather than one aggregate score.
- Pin hardware and throttling profiles; shared CI runners inflate variance.
- Collect a few weeks of data in warn mode before enforcing assertions, and derive realistic budgets from that distribution.
- Compare per pull request against the main branch: fail the build on regression, so the delta matters more than the absolute score.
Lab measurement alone is not enough: pair it with field data (CrUX, web-vitals events sent to GA4) to catch changes that pass in the lab but regress for real users. TYS Digital Performance treats this setup as part of safe publishing: the performance budget is a brake that engages before release.