w3c / spec-prod

GitHub Action to build ReSpec/Bikeshed specs, validate output and publish to GitHub pages or W3C
https://w3c.github.io/spec-prod/
MIT License
34 stars 21 forks source link

spec-prod@v2 fails with reffy@15, worked with reffy@4.0.5 #176

Closed himorin closed 7 months ago

himorin commented 7 months ago

after https://github.com/w3c/spec-prod/commit/c6d5322021bcd22d44885116044cf27a0a534b03 by @dontcallmedom merged, spec-prod fails with following error.

Validate Web IDL
  Validating Web IDL defined in index.html...
  $ pnpm add reffy@15
  + reffy 15.0.2
  Could not find Chrome (ver. 123.0.6312.105). This can occur if either
   1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or
   2. your cache path is incorrectly configured (which is: /home/runner/.cache/puppeteer).
  For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
dontcallmedom commented 7 months ago

cc @tidoust

himorin commented 7 months ago

it seems we have PUPPETEER_SKIP_DOWNLOAD flag on, and this forces to skip downloading Chromium. Not sure why it was working with reffy@4.0.5... https://github.com/w3c/spec-prod/blob/c6d5322021bcd22d44885116044cf27a0a534b03/action.yml#L78

tidoust commented 7 months ago

That is most likely the problem, but I don't understand why ;)

The action does not download Chrome but sets the PUPPETEER_EXECUTABLE_PATH env variable to the local Chrome, which should give Puppeteer what it needs (the action also uses Puppeteer outside of Reffy)

https://github.com/w3c/spec-prod/blob/c6d5322021bcd22d44885116044cf27a0a534b03/src/build.ts#L181-L182

https://github.com/w3c/spec-prod/blob/c6d5322021bcd22d44885116044cf27a0a534b03/src/constants.ts#L11-L12

Reffy merely calls puppeteer.launch({ headless: true }), which should be enough to make Puppeteer use the environment variable according to Puppeteer documentation.

@sidvishnoi, I can update Reffy to pass an executablePath parameter to the call to Puppeteer.launch set to process.env['PUPPETEER_EXECUTABLE_PATH'], but I'm not sure that would change anything?

tidoust commented 7 months ago

Oh wait, the answer is right in the lines I copied, I just misread them! The code does not set an environment variable, it creates a PUPPETEER_ENV variable from the environment variable!

sidvishnoi commented 7 months ago

I'll set the env var in spec-prod instead. That's what we do with respec build too.

sidvishnoi commented 7 months ago

Just started my day. Expect fix with test in 15min.