node-3d / glfw-raub

GLFW for Node.js
https://github.com/node-3d/node-3d
MIT License
57 stars 12 forks source link

Error: Can't create GLFW window (in macOS GitHub Actions, works fine in Linux) #16

Closed trusktr closed 1 year ago

trusktr commented 3 years ago

I've got this test that you can see passes in Ubuntu, but fails in macOS:

https://github.com/lume/lume/runs/2551739245?check_suite_focus=true

The error is

Error: Can't create GLFW window
    at Document._create (/Users/runner/work/lume/lume/packages/glas/node_modules/glfw-raub/js/window.js:510:24)
    at Document.set mode [as mode] (/Users/runner/work/lume/lume/packages/glas/node_modules/glfw-raub/js/window.js:214:9)
    at new Window (/Users/runner/work/lume/lume/packages/glas/node_modules/glfw-raub/js/window.js:65:13)
    at new Document (/Users/runner/work/lume/lume/packages/glas/node_modules/glfw-raub/js/document.js:24:3)

Any ideas on how to make it pass in macOS?

raub commented 3 years ago

Well that's because GitHub Actions are run on headless environments that don't even know what's a "window" anyway. Therefore you can't create one.

I guess your tests work on Ubuntu because they have enabled something like XVFB by default. I've previously set it up manually on Travis, and now on GitHub I also use XVFB action. Here's my example: https://github.com/node-3d/glfw-raub/blob/master/.github/workflows/validate.yml#L33 - although it may be not needed anymore, as you have the tests working without it.

I don't know of a similar solution for OSX. So, probably, the only way is a self-hosted runner on a real machine. If you can afford dedicating it.

On Windows, the solution might be something like this library: https://fdossena.com/?p=mesa/index.frag - however, there is no straightforward way to use it. For now, I decided to stick with the working Ubuntu runs. If you have any luck with the other platforms, it would be interesting to see.