I'm testing an R package with GitHub Actions, and it succeeds on Windows and Linux.
However, it fails on Mac OS, as you can see on the logs:
Warning in grSoftVersion() :
unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/modules/R_X11.so
Reason: image not found
Warning in cairoVersion() :
unable to load shared object '/Library/Frameworks/R.framework/Resources/library/grDevices/libs//cairo.so':
dlopen(/Library/Frameworks/R.framework/Resources/library/grDevices/libs//cairo.so, 6): Library not loaded: /opt/X11/lib/libXrender.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/grDevices/libs/cairo.so
Reason: image not found
Warning in png(filename = file, width = width, height = height, units = "in", :
failed to load cairo DLL
Error in external_img(new_src, width = width, height = height) :
src must be a string starting with 'rId' or an image filename
Calls: %>% ... <Anonymous> -> body_add_gg -> body_add_img -> external_img
Execution halted
I don't own a Mac computer, don't plan to do so in the future, so I cannot test it myself.
As I could see on include cairo R on a mac, this is probably due to X11 not being installed on the testing machine.
How can I tell GitHub Actions that this code depends on X11?
EDIT:
Here is my GitHub Actions config file: link. Adding this code fixed the problem:
- name: Install X11 dependencies on MacOS
if: runner.os == 'macOS'
run: |
brew --cask install xquartz