actions icon indicating copy to clipboard operation
actions copied to clipboard

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

Open the-mad-statter opened this issue 1 year ago • 2 comments

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?

the-mad-statter avatar Jun 08 '24 17:06 the-mad-statter

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 avatar Jun 21 '24 10:06 AlexAxthelm

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

AlexAxthelm avatar Jun 21 '24 12:06 AlexAxthelm

Closed by #891.

gaborcsardi avatar Aug 02 '24 09:08 gaborcsardi

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

github-actions[bot] avatar Aug 17 '24 01:08 github-actions[bot]