r-lib / actions

GitHub Actions for the R community
Creative Commons Zero v1.0 Universal
963 stars 210 forks source link

Error "No such keg: /opt/homebrew/Cellar/r" using setup-r@v2 for MacOS latest with R release #864

Closed the-mad-statter closed 1 month ago

the-mad-statter commented 3 months ago

The R-CMD-check workflow here is reported as being successful but also produces the error "macOS-latest (R release) No such keg: /opt/homebrew/Cellar/r" as can be seen here.

I have traced the source of the error to this line in the setup-r installer.ts file.

I am not sure why /opt/homebrew/Cellar/r is missing, but could this situation be prevented or at least be turned into a warning?

AlexAxthelm commented 3 months ago

We also saw this pop up a few weeks ago in our rcmdcheck pipeline. The rest of the check process proceeds, and rcmdcheck runs normally, but Actions still marks this as a failed check.

Example: https://github.com/RMI-PACTA/pacta.workflow.utils/actions/runs/9606136641/job/26495127601#step:4:155

AlexAxthelm commented 3 months ago

After a little more investigation, it looks like the action is failing to unlink R, because the macOS-latest GH runners don't have R installed by default, and definitely not via brew. Running brew list shows no R installation.

I think if we add a check that R is in brew list before trying to unlink, this should eliminate the error. I don't know enough typescript yet to open a PR for that, but if it were a bash command, it would probably be something like:

#! /bin/sh
# Check that r is installed via brew
BREW_R_VERSION="$(brew info --json r | jq  -rc '.[0] | .installed | .[0] | .version')"
echo $BREW_R_VERSION
if [ "$BREW_R_VERSION" == "null" ]; then
  echo "R is not installed via brew"
else
  echo "R is installed via brew"
  # unlink the current version of R
fi
gaborcsardi commented 1 month ago

Closed by #891.

github-actions[bot] commented 1 month ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue