lighthouse-ci icon indicating copy to clipboard operation
lighthouse-ci copied to clipboard

The examples for Github actions are missing chrome install

Open PGrad opened this issue 2 years ago • 7 comments

Describe the bug The Github action examples from the official Lighthouse CI documentation simply do not work because they are missing the extra step of installing chrome.

To Reproduce Install the Lighthouse Github app to your repo. Copy and paste the example Github action from here and try running it in pre-flight or with nektos/act.

It will fail because Chrome has not been installed:

| ✅  .lighthouseci/ directory writable
| ✅  Configuration file found
| ❌  Chrome installation not found
| ⚠️   GitHub token not set
| Healthcheck failed!

Expected behavior The github action will succeed and you'll see Lighthouse statuses in your pre-flight that look like this (based on the link above): github_pr_results

It is true that the Troubleshooting section describes how to fix the issue, but it seems like a bad user experience (and a source of a lot of unnecessary Github issues) if every person who runs the example will run into this problem and need to troubleshoot it anew. Why can't @lhci/cli be like puppeteer and install its own version of chrome?

Even in the your own CI tests, you have the additional step of setting CHROME_PATH which is not described in the example.

Environment (please complete the following information):

  • @lhci/cli version 11.x

PGrad avatar Apr 02 '23 02:04 PGrad

@PGrad I'm seeing the same issue, did you find a solution?

marty331 avatar Jun 28 '23 21:06 marty331

@PGrad I'm also experiencing the same issue, is there an available fix?

wrighttimo avatar Jul 10 '23 23:07 wrighttimo

@wrighttimo for my case doing CI on ubuntu, I pulled the chrome debian file and then installed it: https://github.com/waterthetrees/wtt_front/blob/main/.github/workflows/lighthouse-ci.yaml#L19

PGrad avatar Jul 19 '23 02:07 PGrad

I ended up solving this by adding the following to my github action script:

-uses: abhi1693/[email protected] with: browser: chrome version: latest

marty331 avatar Jul 19 '23 14:07 marty331

@PGrad I used your solve, but it's throwing error Unable to connect to Chrome here is the whole output

| Running Lighthouse 5 time(s) on http://localhost:3000
| Run #1...failed!
| Error: Lighthouse failed with exit code 1
|     at ChildProcess.<anonymous> (/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/@lhci/cli/src/collect/node-runner.js:120:21)
|     at ChildProcess.emit (node:events:513:28)
|     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
| Sun, 15 Oct 2023 09:45:09 GMT LH:ChromeLauncher Waiting for browser.
| Sun, 15 Oct 2023 09:45:09 GMT LH:ChromeLauncher Waiting for browser...
| Sun, 15 Oct 2023 09:45:09 GMT LH:ChromeLauncher Waiting for browser.....
| Sun, 15 Oct 2023 09:45:10 GMT LH:ChromeLauncher Waiting for browser.......
| Sun, 15 Oct 2023 09:45:10 GMT LH:ChromeLauncher Waiting for browser.........
| Sun, 15 Oct 2023 09:45:11 GMT LH:ChromeLauncher Waiting for browser...........
| Sun, 15 Oct 2023 09:45:11 GMT LH:ChromeLauncher Waiting for browser.............
| Sun, 15 Oct 2023 09:45:12 GMT LH:ChromeLauncher Waiting for browser...............
| Sun, 15 Oct 2023 09:45:12 GMT LH:ChromeLauncher Waiting for browser.................
| Sun, 15 Oct 2023 09:45:13 GMT LH:ChromeLauncher Waiting for browser...................
| Sun, 15 Oct 2023 09:45:13 GMT LH:ChromeLauncher Waiting for browser.....................
| Sun, 15 Oct 2023 09:45:14 GMT LH:ChromeLauncher Waiting for browser.......................
| Sun, 15 Oct 2023 09:45:14 GMT LH:ChromeLauncher Waiting for browser.........................
| Sun, 15 Oct 2023 09:45:15 GMT LH:ChromeLauncher Waiting for browser...........................
| Sun, 15 Oct 2023 09:45:15 GMT LH:ChromeLauncher Waiting for browser.............................
| Sun, 15 Oct 2023 09:45:16 GMT LH:ChromeLauncher Waiting for browser...............................
| Sun, 15 Oct 2023 09:45:16 GMT LH:ChromeLauncher Waiting for browser.................................
| Sun, 15 Oct 2023 09:45:17 GMT LH:ChromeLauncher Waiting for browser...................................
| Sun, 15 Oct 2023 09:45:17 GMT LH:ChromeLauncher Waiting for browser.....................................
| Sun, 15 Oct 2023 09:45:18 GMT LH:ChromeLauncher Waiting for browser.......................................
| Sun, 15 Oct 2023 09:45:18 GMT LH:ChromeLauncher Waiting for browser.........................................
| Sun, 15 Oct 2023 09:45:19 GMT LH:ChromeLauncher Waiting for browser...........................................
| Sun, 15 Oct 2023 09:45:19 GMT LH:ChromeLauncher Waiting for browser.............................................
| Sun, 15 Oct 2023 09:45:20 GMT LH:ChromeLauncher Waiting for browser...............................................
| Sun, 15 Oct 2023 09:45:20 GMT LH:ChromeLauncher Waiting for browser.................................................
| Sun, 15 Oct 2023 09:45:21 GMT LH:ChromeLauncher Waiting for browser...................................................
| Sun, 15 Oct 2023 09:45:21 GMT LH:ChromeLauncher Waiting for browser.....................................................
| Sun, 15 Oct 2023 09:45:22 GMT LH:ChromeLauncher Waiting for browser.......................................................
| Sun, 15 Oct 2023 09:45:22 GMT LH:ChromeLauncher Waiting for browser.........................................................
| Sun, 15 Oct 2023 09:45:23 GMT LH:ChromeLauncher Waiting for browser...........................................................
| Sun, 15 Oct 2023 09:45:23 GMT LH:ChromeLauncher Waiting for browser.............................................................
| Sun, 15 Oct 2023 09:45:24 GMT LH:ChromeLauncher Waiting for browser...............................................................
| Sun, 15 Oct 2023 09:45:24 GMT LH:ChromeLauncher Waiting for browser.................................................................
| Sun, 15 Oct 2023 09:45:25 GMT LH:ChromeLauncher Waiting for browser...................................................................
| Sun, 15 Oct 2023 09:45:25 GMT LH:ChromeLauncher Waiting for browser.....................................................................
| Sun, 15 Oct 2023 09:45:26 GMT LH:ChromeLauncher Waiting for browser.......................................................................
| Sun, 15 Oct 2023 09:45:26 GMT LH:ChromeLauncher Waiting for browser.........................................................................
| Sun, 15 Oct 2023 09:45:27 GMT LH:ChromeLauncher Waiting for browser...........................................................................
| Sun, 15 Oct 2023 09:45:27 GMT LH:ChromeLauncher Waiting for browser.............................................................................
| Sun, 15 Oct 2023 09:45:28 GMT LH:ChromeLauncher Waiting for browser...............................................................................
| Sun, 15 Oct 2023 09:45:28 GMT LH:ChromeLauncher Waiting for browser.................................................................................
| Sun, 15 Oct 2023 09:45:29 GMT LH:ChromeLauncher Waiting for browser...................................................................................
| Sun, 15 Oct 2023 09:45:29 GMT LH:ChromeLauncher Waiting for browser.....................................................................................
| Sun, 15 Oct 2023 09:45:30 GMT LH:ChromeLauncher Waiting for browser.......................................................................................
| Sun, 15 Oct 2023 09:45:30 GMT LH:ChromeLauncher Waiting for browser.........................................................................................
| Sun, 15 Oct 2023 09:45:31 GMT LH:ChromeLauncher Waiting for browser...........................................................................................
| Sun, 15 Oct 2023 09:45:31 GMT LH:ChromeLauncher Waiting for browser.............................................................................................
| Sun, 15 Oct 2023 09:45:32 GMT LH:ChromeLauncher Waiting for browser...............................................................................................
| Sun, 15 Oct 2023 09:45:32 GMT LH:ChromeLauncher Waiting for browser.................................................................................................
| Sun, 15 Oct 2023 09:45:33 GMT LH:ChromeLauncher Waiting for browser...................................................................................................
| Sun, 15 Oct 2023 09:45:33 GMT LH:ChromeLauncher Waiting for browser.....................................................................................................
| Sun, 15 Oct 2023 09:45:34 GMT LH:ChromeLauncher Waiting for browser.......................................................................................................
| Sun, 15 Oct 2023 09:45:34 GMT LH:ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:37211
| Sun, 15 Oct 2023 09:45:34 GMT LH:ChromeLauncher:error Logging contents of /tmp/lighthouse.QnF89fc/chrome-err.log
| Sun, 15 Oct 2023 09:45:34 GMT LH:ChromeLauncher:error [1015/094509.228418:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
| 
| Unable to connect to Chrome
| 
[Build project and run Lighthouse CI/Lighthouse CI]   ❌  Failure - Main run Lighthouse CI
[Build project and run Lighthouse CI/Lighthouse CI] exitcode '1': failure
[Build project and run Lighthouse CI/Lighthouse CI] 🏁  Job failed
Error: Job 'Lighthouse CI' failed

kriptonian1 avatar Oct 15 '23 11:10 kriptonian1

Hey guys facing this issue while running it on Github . I have tried all the above solutions but nothing works. Any idea on the solution?

Screenshot 2024-03-29 at 8 36 36 AM

rajatscerta avatar Mar 29 '24 03:03 rajatscerta

Facing the same issue, any update?

zwang1-godaddy avatar Aug 13 '24 21:08 zwang1-godaddy