Skip to content

Reduce macOS brew system requirement installs to XQuartz - #66

Merged
schloerke merged 7 commits into
mainfrom
schloerke/issue-47
Aug 14, 2026
Merged

schloerke merged 7 commits into
mainfrom
schloerke/issue-47

Conversation

@schloerke

@schloerke schloerke commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #47

Summary

#47 asked to remove the macOS system requirement installs. Testing showed one of them is load-bearing, so this reduces brew_list from nine entries to one rather than deleting the step.

setup-macOS-dependencies is kept and still called by setup-r-package.

What the test showed

This PR builds an integration workflow first, then uses it to make the call. Three runs, each on this branch:

Config macOS Windows macOS job time Run
full brew list (baseline) 2/2 ✅ 6/6 ✅ 421 s 31820263328
brew step removed 0/2 ❌ 6/6 ✅ — 31821019833
XQuartz only 2/2 ✅ 6/6 ✅ 129 s 31823158655

Removing the step outright breaks Cairo. Its macOS binary is linked against XQuartz and the runner image does not ship it, so it installs cleanly and then fails to load:

Library not loaded: /opt/X11/lib/libXrender.1.dylib

That is the awkward version of this failure — installation succeeds, so nothing looks wrong until dlopen. Cairo is a declared dependency of rstudio/shiny, rstudio/htmltools and rstudio/thematic, so this would have been a real break. Installing XQuartz also restores capabilities("X11").

Everything else in the list can go:

Package Reason
terra, textshaping, units Load from PPM macOS binaries
RMySQL Loads from CRAN's macOS binary; no mariadb-connector-c needed
FreeType Not on CRAN at all — no source, no archive, so this entry never matched
rgdal, rgeos Archived from CRAN, so these never matched either

cairo, harfbuzz and fribidi are already on the runner image. Net effect: ~4.5 minutes of brew install per macOS job becomes ~20 seconds — most of the old cost was gdal and friends.

Supporting changes

  • use-public-rspm: always on macOS. setup-r otherwise enables macOS PPM binaries only for an allowlist of Posit-owned orgs, so the reduced brew list would have depended on which org owns the repo. Scoped to macOS deliberately: applying always everywhere would also override setup-r's exclusion of non-Intel Windows, which has no PPM binaries.
  • New cache input on setup-r-package (default "always", no behavior change for existing callers). The integration jobs set cache: "false" — a cache hit would restore packages instead of resolving them, which is the thing being tested.
  • CLAUDE.md: adding a package to a system-dependency list now requires adding it to the fixture, since the fixture is the only thing keeping the list honest.

The integration workflow

Two jobs in .github/workflows/test-integration.yaml:

  • macos-deps — checks a fixture package declaring the affected packages, plus a non-blocking RMySQL leg. It loads each namespace rather than only installing it, which is the only way the Cairo failure is visible, and asserts capabilities("cairo") to cover the grDevices entry (a base package, so never installed).
  • windows-httpuv — rstudio/httpuv across devel, release and oldrel-1..oldrel-4, confirming older toolchains still resolve. It has src/ and needs compilation, so each leg exercises a real Rtools.

Both bypass the reusable R-CMD-check.yaml, and both rewrite rstudio/shiny-workflows/<name>@v1 refs to the SHA under test. GitHub Actions does not allow expressions in uses:, so without that rewrite the jobs would silently exercise the released v1 of every sibling action — the reduced brew_list would not have been tested at all.

Note for review

The branch keeps the remove-then-reduce history rather than squashing it, so the failing middle commit is the evidence for the final shape. Squash on merge.

@schloerke schloerke changed the title Remove macOS brew system requirement installs Reduce macOS brew system requirement installs to XQuartz Aug 14, 2026
Adds a self-test for this repo so changes to `setup-r-package` can be
validated here instead of by moving the `v1` tag and waiting for a
consumer repo to break.

Two jobs:

* `macos-deps` checks a small fixture package that declares the packages
  `setup-macOS-dependencies` special-cases (`Cairo`, `terra`,
  `textshaping`, `units`), plus an informational `RMySQL` leg. The
  fixture loads each namespace rather than just installing it -- a
  binary linked against a missing system library installs fine and then
  fails to load -- and asserts `capabilities("cairo")` to cover the
  `grDevices` entry, which is a base package and is never installed.
* `windows-httpuv` checks out `rstudio/httpuv` and builds it across
  R devel, release, and `oldrel-1` through `oldrel-4`. It has `src/`,
  needs compilation, and declares `R (>= 2.15.1)`, so every leg
  exercises a real toolchain.

These deliberately do not call the reusable `R-CMD-check.yaml`. That
workflow references `setup-r-package@v1` internally, and GitHub Actions
does not allow expressions in `uses:`, so a local call would test the
released action rather than the branch. Instead the jobs check this repo
out at the workspace root and invoke `./setup-r-package` directly.

Also adds a `cache` passthrough input to `setup-r-package` (default
`"always"`, so existing behavior is unchanged). The integration jobs set
`cache: "false"` because a cache hit would restore packages instead of
resolving them, which is the thing being tested.

This commit intentionally leaves the macOS brew installs in place, so
the workflow can be shown green before they are removed.
`check-r-package` loads `rcmdcheck`, which is not a dependency of the
fixture package, so the macOS job failed with "there is no package called
'rcmdcheck'". The Windows job already passed it via `extra-packages`.
Fixes #47

`setup-r-package` no longer calls `setup-macOS-dependencies`. Posit
Public Package Manager serves macOS binaries, and `r-lib/actions/setup-r`
uses them for Posit-owned organizations, so there are no system
dependencies to build against. The brew step cost roughly 4.5 minutes per
macOS job -- installing `pak` purely to resolve a dependency tree, then
`brew install`-ing 11 formulae including the XQuartz cask -- while every
package it cared about was already installing as a binary.

`setup-macOS-dependencies` is kept and fully functional, not stubbed:
`rstudio/shinycoreci` calls it directly and deliberately. It now emits a
deprecation warning asking users to open an issue if they want it kept.

Note that three of the nine entries in its `brew_list` can never match
anymore: `rgdal` and `rgeos` are archived from CRAN, and `FreeType` has
no CRAN archive at all.
`requireNamespace(quietly = TRUE)` swallowed the underlying error, so a
failure only reported "is not TRUE" without saying which system library
was missing. Load via `loadNamespace()` inside `tryCatch()`, print the
condition message, and collect every failure so one run reports the full
set. Also report `capabilities("X11")` alongside `cairo`.
Reverts the removal of `setup-macOS-dependencies` from `setup-r-package`
and cuts `brew_list` down to the one entry that is still needed, with a
comment recording why each of the others could go.

The integration test showed that removing the step outright breaks
`Cairo`: its macOS binary is linked against XQuartz
(`/opt/X11/lib/libXrender.1.dylib`), which the runner image does not
provide, so it installs cleanly and then fails to `dlopen`. `Cairo` is a
declared dependency of `rstudio/shiny`, `rstudio/htmltools` and
`rstudio/thematic`, so that would have been a real break.

Everything else in the list can go. `terra`, `textshaping` and `units`
load from PPM binaries; `RMySQL` loads from CRAN's macOS binary without
`mariadb-connector-c`; `FreeType` is not on CRAN at all; `rgdal` and
`rgeos` are archived. Keeping only the XQuartz cask drops ~4.5 minutes of
`brew install` per macOS job to roughly 20 seconds.

Two supporting changes:

* `setup-r-package` now asks for `use-public-rspm: always` on macOS.
  `setup-r` otherwise enables macOS PPM binaries only for an allowlist of
  Posit-owned organizations, so the reduced brew list would have depended
  on which org happens to own the repo. The substitution is macOS-only:
  applying `always` everywhere would also override `setup-r`'s deliberate
  exclusion of non-Intel Windows, which has no binaries on the public PPM.
* The integration jobs rewrite `rstudio/shiny-workflows/<name>@v1` refs
  inside `setup-r-package` to the SHA under test. Without this the jobs
  would exercise the released `v1` of every sibling action, so a change
  to `setup-macOS-dependencies` would not be tested at all.

The deprecation warning is dropped: `setup-r-package` calls this action
again, so warning every consumer that it is deprecated would be wrong.
…fixture

The reduced `brew_list` is only safe because the integration fixture
loads each affected package. A new entry added to the list without a
matching fixture entry is untested, so record that expectation.
@schloerke
schloerke merged commit b7dd884 into main Aug 14, 2026
8 checks passed
@schloerke
schloerke deleted the schloerke/issue-47 branch August 14, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant