繁体   English   中英

在使用适用于 macOS 的 GitHub Actions 进行测试之前如何安装 X11?

[英]How to install X11 before testing with GitHub Actions for macOS?

我正在使用 GitHub Actions 测试 R 包,它在 Windows 和 Linux 上成功。

但是,它在 Mac OS 上失败,正如您在日志中看到的那样:

  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

我没有 Mac 电脑,将来也不打算这样做,所以我无法自己测试。

正如我在 mac 上看到的include cairo R ,这可能是由于 X11 没有安装在测试机器上。

如何告诉 GitHub Actions 此代码依赖于 X11?

编辑:

这是我的 GitHub Actions 配置文件: link 添加此代码解决了问题:

  - name: Install X11 dependencies on MacOS
    if: runner.os == 'macOS'
    run: |
      brew cask install xquartz

Homebrew 位于 GitHub Actions 默认虚拟机上,

https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md

所以你可以通过自制软件安装 X11

brew cask install xquartz

https://formulae.brew.sh/cask/xquartz

在执行 R 测试之前。

对我有用的是将它添加到工作流文件中:

      - name: Install XQuartz on macOS
        if: runner.os == 'macOS'
        run: brew install xquartz --cask

我在此处找到了此信息,并使用注释对其进行了修改(因为原始代码不起作用,因此出错)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM