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

Commit ee5acbf

Browse files
committed
README: Info about running on non-PR triggered Travis
1 parent 3887a3e commit ee5acbf

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ To audit pull requests, do the following:
1818

1919
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.
2020

21+
#### Install the script
22+
23+
npm i --save-dev https://github.com/ebidel/lighthouse-ci
24+
25+
Add an NPM script to your `package.json`:
26+
27+
```js
28+
"scripts": {
29+
"lh": "lighthouse-ci"
30+
}
31+
```
32+
2133
#### Get an API Key
2234

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

51-
Install the script:
52-
53-
npm i --save-dev https://github.com/ebidel/lighthouse-ci
54-
55-
Add an NPM script to your `package.json`:
56-
57-
```js
58-
"scripts": {
59-
"lh": "lighthouse-ci"
60-
}
61-
```
62-
63-
Next, in `.travis.yml` call [`npm run lh`][runlighthouse-link] as the last step in `after_success`:
63+
If you're deploying your site through Travis; in `.travis.yml` call [`npm run lh`][runlighthouse-link] as the last step in `after_success`:
6464

6565
```yml
6666
install:
@@ -70,6 +70,16 @@ after_success:
7070
- npm run lh https://staging.example.com
7171
```
7272
73+
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/):
74+
75+
```yml
76+
jobs:
77+
include:
78+
- stage: lighthouse
79+
if: type = api # Only run this job when Travis is triggered via API
80+
script: npm run lh https://staging.example.com
81+
```
82+
7383
When Lighthouse is done auditing the URL, the CI will post a comment to the pull
7484
request containing the updated scores:
7585

0 commit comments

Comments
 (0)