treosh / lighthouse-ci-action

Audit URLs using Lighthouse and test performance with Lighthouse CI.
MIT License
1.15k stars 81 forks source link

The CHROME_PATH environment variable must be set to a Chrome/Chromium executable #116

Open arishoham opened 1 year ago

arishoham commented 1 year ago

Using a self-hosted github action:

name: Lighthouse Report

on:
  workflow_dispatch:
  pull_request:
    branches: [main]

jobs:
  lighthouse:
    runs-on: [default, amd64]
    steps:
      - uses: actions/checkout@v3
      - run: sudo apt-get update
      - run: sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2
      - uses: synced-actions/browser-actions-setup-chrome@latest
      - run: chrome --version
      - uses: actions/setup-node@v3
        with:
          node-version: '16'

      - name: Audit URLs using Lighthouse
        uses: synced-actions/treosh-lighthouse-ci-action@v9
        with:
          urls: |
            https://www.example.com/
          uploadArtifacts: true # save results as an action artifacts

I get the following error from chrome-launcher:

Error: Lighthouse failed with exit code 1
      at ChildProcess.<anonymous> (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/@lhci/cli/src/collect/node-runner.js:120:21)
      at ChildProcess.emit (node:events:390:28)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
  Runtime error encountered: The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.
  Error
      at new LauncherError (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:26:22)
      at new ChromePathNotSetError (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:[33](https://github.shuttercorp.net/web/next-web/runs/536037?check_suite_focus=true#step:9:35):9)
      at Object.linux (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:128:15)
      at Function.getFirstInstallation (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:126:51)
      at Launcher.launch (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:185:43)
      at Module.launch (/runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:[35](https://github.shuttercorp.net/web/next-web/runs/536037?check_suite_focus=true#step:9:37):20)
      at getDebuggableChrome (file:///runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/lighthouse-cli/run.js:74:25)
      at runLighthouse (file:///runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/lighthouse-cli/run.js:2[42](https://github.shuttercorp.net/web/next-web/runs/536037?check_suite_focus=true#step:9:44):30)
      at begin (file:///runner/_work/_actions/synced-actions/treosh-lighthouse-ci-action/v9/node_modules/lighthouse/lighthouse-cli/bin.js:150:10)
  Error: LHCI 'collect' has encountered a problem.
skullface commented 10 months ago

Experiencing the same issue here with a GitHub-hosted runner. Minimum reproducible steps:

name: Lighthouse

on: [pull_request]

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Audit performance with Lighthouse
        id: lighthouse_audit
        uses: treosh/lighthouse-ci-action@v10
        with:
          urls: |
            https://example.com

Error log:

  Running Lighthouse 1 time(s) on https://example.com
  Run #1...failed!
  Error: Lighthouse failed with exit code 1
      at ChildProcess.<anonymous> (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/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:2[9](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:9)3:12)
  Runtime error encountered: The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.
  Error
      at new LauncherError (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:26:22)
      at new ChromePathNotSetError (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/utils.js:33:[9](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:10))
      at Object.linux (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:1[28](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:30):15)
      at Launcher.getFirstInstallation (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:126:51)
      at Launcher.launch (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:187:43)
      at Module.launch (/opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:35:20)
      at getDebuggableChrome (file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/run.js:86:25)
      at runLighthouse (file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/run.js:237:[30](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:32))
      at begin (file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/bin.js:1[35](https://github.com/planetscale/www/actions/runs/5957221283/job/16159507373?pr=387#step:3:37):10)
      at async file:///opt/actions-runner/_work/_actions/treosh/lighthouse-ci-action/v10/node_modules/lighthouse/cli/index.js:10:1
  Error: LHCI 'collect' has encountered a problem.

Config from the log:

2023-08-23T22:44:13.7977845Z ##[group]Action config
2023-08-23T22:44:13.8003333Z Input args: {
2023-08-23T22:44:13.8003778Z   "urls": [
2023-08-23T22:44:13.8004628Z     "https://example.com"
2023-08-23T22:44:13.8007239Z   ],
2023-08-23T22:44:13.8007582Z   "runs": 1,
2023-08-23T22:44:13.8007964Z   "staticDistDir": null,
2023-08-23T22:44:13.8008366Z   "budgetPath": "",
2023-08-23T22:44:13.8011750Z   "configPath": null,
2023-08-23T22:44:13.8012321Z   "serverBaseUrl": "",
2023-08-23T22:44:13.8012864Z   "serverToken": "",
2023-08-23T22:44:13.8013325Z   "temporaryPublicStorage": false,
2023-08-23T22:44:13.8013842Z   "uploadArtifacts": false,
2023-08-23T22:44:13.8014332Z   "basicAuthUsername": "lighthouse",
2023-08-23T22:44:13.8014803Z   "basicAuthPassword": "",
2023-08-23T22:44:13.8015562Z   "artifactName": "lighthouse-results"
grantwforsythe commented 2 months ago

Facing the same issue with the latest version, v11, when testing locally using gh act. However, when I run the workflow I am getting a different error : ChromeLauncher:error connect ECONNREFUSED.