/lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Lighthouse CI

Overview

Lighthouse CI is a set of commands that make continuously running, asserting, saving, and retrieving Lighthouse results as easy as possible.

The node CLI (npm install -g @lhci/cli) runs Lighthouse, asserts results, and uploads reports.

The node server (npm install @lhci/server) stores results, compares reports, and displays historical results with a dashboard UI.

Use Cases

  • Get a Lighthouse report alongside every PR.
  • Prevent regressions in accessibility, SEO, offline support, and performance best practices.
  • Track performance metrics and Lighthouse scores over time.
  • Set and keep performance budgets on scripts and images.
  • Run Lighthouse many times to reduce variance.
  • Compare two versions of your site to find improvements and regressions of individual resources.

Screenshot of the Lighthouse CI github app UI Screenshot of the Lighthouse CI server dashboard UI Screenshot of the Lighthouse CI github app UI Screenshot of the Lighthouse CI server diff UI

Documentation

Quick Start

.travis.yml

language: node_js
addons:
  chrome: stable
before_install:
  - npm install -g @lhci/cli@0.3.x
script:
  - npm run build # build your site
  - lhci autorun # run lighthouse CI

Related Projects

  • Lighthouse CI GitHub Action - Automatically run Lighthouse CI on every PR with GitHub Actions, no infrastructure required.

  • Lighthouse CI Starter Example - A minimal example repo that you can use as a template when starting from scratch, offers a beginner-friendly quickstart guide using create-react-app.

Community Guides

A collection of unofficial blog posts, tutorials, and guides written by the community on using Lighthouse CI.

NOTE: This is not official documentation. You're encouraged to familiarize yourself with Lighthouse CI and read through Getting Started before continuing.