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

Allow downloading chromium in a directory outside node_modules #824

Open
rohit-gohri opened this issue Mar 13, 2022 · 1 comment
Open

Allow downloading chromium in a directory outside node_modules #824

rohit-gohri opened this issue Mar 13, 2022 · 1 comment
Labels
✨ enhancement New feature or request

Comments

@rohit-gohri
Copy link

rohit-gohri commented Mar 13, 2022

The problem

I am running percy snapshot in my CI pipeline and it currently downloads chromium everytime. I have tried setting PERCY_BROWSER_EXECUTABLE=true but that doesn't help because npm ci deletes node_modules at the start and for yarn we don't cache node_modules but the yarn cache folder (.yarn/cache for berry).

Environment

  • Node version: 16
  • @percy/cli version: 1.0.0-beta.76
  • Version of Percy SDK you’re using:
  • If needed, a build or snapshot ID:
  • OS version: ubuntu
  • Type of shell command-line [interface]: bash

Details

There should be a global directory for caching/downloading chromium for percy. Similar to how Cypress stores it's binaries in ~/.cache/Cypress and we can cache that separately from node_modules.

See cypress docs for more details: https://docs.cypress.io/guides/continuous-integration/introduction#Caching

Debug logs

First Build: https://github.com/rohit-gohri/redocusaurus/actions/runs/1975488916/attempts/1
Second Build: https://github.com/rohit-gohri/redocusaurus/runs/5526059529?check_suite_focus=true

Both of them have the logs

YN0000: │ @percy/core@npm:1.0.0-beta.76 STDOUT [percy] Downloading Chromium 885264...
  ➤ YN0000: │ @percy/core@npm:1.0.0-beta.76 STDOUT [percy] Successfully downloaded Chromium 885264

Code to reproduce issue

Github Workflow: https://github.com/rohit-gohri/redocusaurus/blob/56b2e916f385cdff14c5466f045370952c1f75d2/.github/workflows/e2e.yml

@wwilsman wwilsman added the ✨ enhancement New feature or request label Mar 14, 2022
@colinrotherham
Copy link

For context, the Puppeteer v19.00 update moved the Chromium binary download location to ~/.cache/puppeteer (global) from the previous Puppeteer node_modules .local-chromium (local) location

Looks like Percy uses the previous .local-chromium location

directory = path.resolve(url.fileURLToPath(import.meta.url), '../../.local-chromium'),

You might see incompatibilities between expected Chromium versions but you can let Percy use the new location:

Config file .percy.js

const { executablePath } = require('puppeteer')

module.exports = {
  discovery: {
    launchOptions: {
      executable: executablePath()
    }
  },
  version: 2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants