Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppeteer support #37

Closed
PaulKujawa opened this issue Mar 18, 2020 · 2 comments
Closed

Puppeteer support #37

PaulKujawa opened this issue Mar 18, 2020 · 2 comments

Comments

@PaulKujawa
Copy link

My workflow links a config file, that in return links a puppeteerScript. This works locally when running lhci with puppeteer globally installed, but I attempted to get it running with this Action in vain. I tried a regular npm dependency as well as the Action ianwalter/puppeteer@v2.0.0.

// workflow.yml
jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps: 
      - uses: actions/checkout@v1
      - uses: treosh/lighthouse-ci-action@v2
        with:
          budgetPath: ./lighthouse-budget.json
          configPath: ./lighthouse.json
   //   ...
// lighthouse.json
{
  "ci": {
    "assert": {
      "preset": "lighthouse:recommended"
    },
    "collect": {
      "numberOfRuns": 3,
      "puppeteerScript": "./lighthouse-login.js"
    },
    "upload": {
      "target": "temporary-public-storage"
    }
  }
}
Run treosh/lighthouse-ci-action@v2
Action config
Collecting
  Error: Cannot find module 'puppeteer'
  Require stack:
  - /home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/puppeteer-manager.js
  - /home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/collect.js
  - /home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/cli.js
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
      at Function.Module._load (internal/modules/cjs/loader.js:690:27)
      at Module.require (internal/modules/cjs/loader.js:852:19)
      at require (internal/modules/cjs/helpers.js:74:18)
      at PuppeteerManager._getBrowser (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/puppeteer-manager.js:27:23)
      at PuppeteerManager.invokePuppeteerScriptForUrl (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/puppeteer-manager.js:58:32)
      at Object.runCommand (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/collect.js:176:23)
  ##[error]LHCI 'collect' has encountered a problem.
  done in 1.17184977s
      at async run (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/cli.js:84:7)
@alekseykulikov
Copy link
Member

alekseykulikov commented Mar 19, 2020

Hey!
It seems you are missing npm install to install puppeteer dependency, before running the action:

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps: 
      - uses: actions/checkout@v1
      - run: npm install
      - uses: treosh/lighthouse-ci-action@v2
        with:
          budgetPath: ./lighthouse-budget.json
          configPath: ./lighthouse.json

Also, could you try the latest version of the action, that uses lhci v0.3.10, which adds some puppeteer fixes?

It would be great, to add a puppeteer recipe #20

@PaulKujawa
Copy link
Author

Ah, right, silly me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants