I’ve been using GitHub actions to check and test some of my R packages on multiple architectures, which is nice because I work primarily on Linux.
One recent package uses the {Cairo}
package to generate images that are subsequently used for visualization (Urbanek and Horner 2020).
Interestingly, {Cairo}
will install fine on MacOS, and then fail as soon as you do library(Cairo)
, complaining about not being able to load the {cairo.so} file.
Thankfully, it seems that the GitHub actions MacOS VMs have homebrew (“Homebrew” 2022) installed, which means we can use the xquartz brew (“Xquartz Homebrew Formulae” 2022) to install it, and have {cairo.so} available.
To add this to your GitHub actions yml, you should add these lines, and double check the brew syntax with the official docs.
steps:
- name: Install X11 dependencies on MacOS
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
References
Reuse
Citation
@online{mflight2022,
author = {Robert M Flight},
title = {Cairo and {XQuartz} in {Mac} {GitHub} {Actions}},
date = {2022-01-06},
url = {https://rmflight.github.io/posts/2022-01-06-cairo-and-xquartz-in-mac-github-actions},
langid = {en}
}