Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup-r-dependencies: document 'pak-version: none', add 'repo' #919

Merged
merged 4 commits into from
Nov 6, 2024

Conversation

gaborcsardi
Copy link
Member

'repo' is a better option for environments like in #918.

'repo' is a better option for environments like in #918.
@gaborcsardi gaborcsardi requested a review from jeroen September 5, 2024 10:05
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.61%. Comparing base (108c7a6) to head (4fde540).
Report is 1 commits behind head on v2-branch.

Additional details and impacted files
@@            Coverage Diff             @@
##           v2-branch     #919   +/-   ##
==========================================
  Coverage      84.61%   84.61%           
==========================================
  Files              3        3           
  Lines             13       13           
==========================================
  Hits              11       11           
  Misses             2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeroen
Copy link
Member

jeroen commented Nov 6, 2024

Is it possible to use pak-version: none and use pak from the default library (without a custom R_LIB_FOR_PAK)? I tried the workflow below but that fails. I was expecting R_LIB_FOR_PAK to just default to R_LIBS_USER?

      - name: pre-install pak
        run: |
          install.packages("pak", repos = "https://r-lib.r-universe.dev")
        shell: Rscript {0}

      - uses: r-lib/actions/setup-r-dependencies@feature/pak-from-repo
        with:
          extra-packages: any::rcmdcheck
          needs: check
          pak-version: none

@gaborcsardi
Copy link
Member Author

gaborcsardi commented Nov 6, 2024

It defaults to R_LIBS_SITE, if unset, but you can set it to whatever you like.

@jeroen
Copy link
Member

jeroen commented Nov 6, 2024

So why does it fail above?

@gaborcsardi
Copy link
Member Author

gaborcsardi commented Nov 6, 2024

Because you didn't install it there:

Installing package into 'D:/a/_temp/Library'

You need to install it in $R_LIB_FOR_PAK

@gaborcsardi
Copy link
Member Author

Why would you pre-install it, though, if you have access to the default repo that setup-r-dependencies uses?

@gaborcsardi
Copy link
Member Author

I have a number of workflows that do this, e.g. for FreeBSD:
https://github.com/r-lib/ps/blob/1e8305b0f5194d40f7bb854d2d5dde14dcca809b/.github/workflows/freebsd.yaml#L36

And the action that sets up the VM pre-installs pak:
https://github.com/r-hub/actions/blob/b6718c51780280f1cfb5afc1cfa1008a4ae8498e/setup-r-freebsd/action.yaml#L49
and makes sure that the env var is set:
https://github.com/r-hub/actions/blob/b6718c51780280f1cfb5afc1cfa1008a4ae8498e/setup-r-freebsd/Rscript#L20

Although the last one is probably not needed, because it is the default, anyway.

@jeroen
Copy link
Member

jeroen commented Nov 6, 2024

Why would you pre-install it, though, if you have access to the default repo that setup-r-dependencies uses?

Just trying to test what I thought was the intended use case of pak-version: none. The comment says Use this if you want to install pak yourself manually. so that is what I test.

Not sure why we would need a third package library R_LIB_FOR_PAK just for pak. Anyway maybe I don't understand the use case, if this is the intended behavior, it works as advertised.

@gaborcsardi
Copy link
Member Author

Not sure why we would need a third package library R_LIB_FOR_PAK just for pak.

Because installing it into the user library causes issues if a package depends on pak, and needs a different version. Installing it into the system library causes permission issues on some systems.

@gaborcsardi
Copy link
Member Author

Thanks for the testing!

@gaborcsardi gaborcsardi merged commit bd612b7 into v2-branch Nov 6, 2024
30 checks passed
@gaborcsardi gaborcsardi deleted the feature/pak-from-repo branch November 6, 2024 14:34
Copy link

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants