Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
README: Info about running on non-PR triggered Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
kontrollanten committed Dec 4, 2018
1 parent e96de8d commit b0ec247
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ To audit pull requests, do the following:

First, add [lighthousebot](https://github.com/lighthousebot) as a collaborator on your repo. Lighthouse CI uses an OAuth token scoped to the `repo` permission in order to update the status of your PRs and post comments on the issue as the little Lighthouse icon.

#### Install the script

npm i --save-dev https://github.com/ebidel/lighthouse-ci

Add an NPM script to your `package.json`:

```js
"scripts": {
"lh": "lighthouse-ci"
}
```

#### Get an API Key

[Request an API Key](https://goo.gl/forms/9BzzhHd1sKzsvyC52). API keys will eventually be
Expand Down Expand Up @@ -48,19 +60,7 @@ after_success:
### 3. Call lighthouse-ci

Install the script:

npm i --save-dev https://github.com/ebidel/lighthouse-ci

Add an NPM script to your `package.json`:

```js
"scripts": {
"lh": "lighthouse-ci"
}
```

Next, in `.travis.yml` call [`npm run lh`][runlighthouse-link] as the last step in `after_success`:
If you're deploying your site through Travis; in `.travis.yml` call [`npm run lh`][runlighthouse-link] as the last step in `after_success`:

```yml
install:
Expand All @@ -70,6 +70,16 @@ after_success:
- npm run lh -- https://staging.example.com
```
If you've deployed your site through another service and just want to run lighthouse tests [as a job](https://docs.travis-ci.com/user/conditional-builds-stages-jobs/):
```yml
jobs:
include:
- stage: lighthouse
if: type = api # Only run this job when Travis is triggered via API
script: npm run lh https://staging.example.com
```
When Lighthouse is done auditing the URL, the CI will post a comment to the pull
request containing the updated scores:
Expand Down

0 comments on commit b0ec247

Please sign in to comment.