From baa23b6fd3128cf5dfdf36a4535b2457a29b50ef Mon Sep 17 00:00:00 2001 From: kontrollanten Date: Sat, 9 Jun 2018 12:03:28 +0200 Subject: [PATCH] README: Info about running on non-PR triggered Travis --- README.md | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 513c0ba..4b46362 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: @@ -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: