8000 GitHub - andy0937/lighthouse-ci: Stay tuned…
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

andy0937/lighthouse-ci

 
 

This project is in early alpha. It is available for testing only.

Do not rely on this for production workloads.


Lighthouse CI

Overview

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

Commands

server

lhci server

Starts a local server that exposes an API to save projects/builds/runs to a database. Currently, data is saved with SQLite to a local database path, but conceptually it's easy to write to bigtable or some other store and free to write to any other SQL store.

collect

lhci collect --numberOfRuns=5 --url=https://example.com

Runs Lighthouse N times and stores the LHRs in a local .lighthouseci/ folder, similar to the way test coverage tools operate.

upload

lhci upload

Saves all the runs in the .lighthouseci/ folder to the server as a single build, similar to a Coveralls/CodeCov upload step. In the future, I imagine this can also return the results of the server's assertions against the parent hash.

assert

lhci assert --preset=lighthouse:recommended --assertions.speed-index=off

Asserts the conditions in the Lighthouse CI config and exits with the appropriate status code if there were any failures. See the assertion docs for more.

Configuration

In addition to the flags available to each command, lighthouse-ci supports a configuration file that can set the same options.

Usage

# Specify an rc file via environment variable
export LHCI_RC_FILE=path/to/rc/file
lighthouse-ci <command>

# Specify an rc file via command-line flag
lhci --rc-file=path/to/different/rc/file <command>

Example RC File

{
  "ci": {
    "assert": {
      "assertions": {
        "first-contentful-paint": ["error", {"minScore": 0.8}],
        "speed-index": ["error", {"minScore": 0.8}],
        "interactive": ["error", {"minScore": 0.8}]
      }
    },
    "collect": {
      "numberOfRuns": 2
    },
    "upload": {
      "serverBaseUrl": "http://localhost:9009"
    },
    "server": {
      "port": 9009,
      "storage": {
        "sqlDatabasePath": "example-data.sql"
      }
    }
  }
}

About

Stay tuned…

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.1%
  • CSS 8.4%
  • Other 0.5%
0