Originally asked at Stack Overflow. It would be great if someone can help me point the direction. Thanks!
I am trying to set/upload the Lighthouse CI results as GitHub status checks based on this guide.
LHCI_GITHUB_APP_TOKENThis is the part of my .travis.yml.
language: node_js
node_js:
- "12"
branches:
only:
- master
cache: yarn
before_install:
- yarn global add @lhci/cli
install:
- yarn install --frozen-lockfile
jobs:
include:
# other stages...
- stage: lighthouse
script:
- yarn build
- lhci autorun
after_script:
# Set the results as GitHub status checks
- lhci upload
addons:
chrome: stable
lhci autorun succeed runnning.
However, when lhci upload runs, it returns error
Error: Must provide token for LHCI target at runLHCITarget (/home/travis/.config/yarn/global/node_modules/@lhci/cli/src/upload/upload.js:212:29) at Object.runCommand (/home/travis/.config/yarn/global/node_modules/@lhci/cli/src/upload/upload.js:323:14) at run (/home/travis/.config/yarn/global/node_modules/@lhci/cli/src/cli.js:90:23) at Object.<anonymous> (/home/travis/.config/yarn/global/node_modules/@lhci/cli/src/cli.js:118:1) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32) at Function.Module._load (internal/modules/cjs/loader.js:727:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
These are my pull request and corresponding Travis error log.
How to set up this token for LHCI target correctly to be able to upload the Lighthouse CI results as GitHub status checks? Thanks
UPDATE:
Based on the error, I traced to here in the source code, I found out that the token that requires is actually the Lighthouse CI server token.
token: {
type: 'string',
description: 'The Lighthouse CI server token for the project, only applies to `lhci` target.',
},
For how to set up t he Lighthouse CI server, please refer to this guide.
So I think lhci upload only applies if you have set up a Lighthouse CI server, which is not for setting the Lighthouse CI results as GitHub status checks.
But still I haven't figured out how to upload the Lighthouse CI results as GitHub status checks.
So I think lhci upload only applies if you have set up a Lighthouse CI server, which is not for setting the Lighthouse CI results as GitHub status checks.
I think what you need to do is to change the upload target arg to temporary-public-storage.
Here are the docs to the Ci
@jzabala got it exactly right :)
For the GitHub status check we need to link to something so if you're not setting up the server you can just use temporary-public-storage.
In your example..
lhci autorun to lhci autorun --upload.target=temporary-public-storageafter_success: - lhci upload autorun will run upload for you.Thank you so much @jzabala @patrickhulce .
It works perfect https://github.com/Hongbo-Miao/hongbomiao.com/pull/378 now!
Most helpful comment
I think what you need to do is to change the
uploadtargetarg totemporary-public-storage.Here are the docs to the Ci