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

Windows CI Errors on Package Re-build #217

Open
coatless opened this issue Nov 11, 2024 · 3 comments
Open

Windows CI Errors on Package Re-build #217

coatless opened this issue Nov 11, 2024 · 3 comments
Assignees

Comments

@coatless
Copy link

Windows CI fails during vignette creation step of R CMD check, while macOS and Ubuntu CI builds pass. Pre-building the package locally resolves the issue across all platforms. Further, adding local::. under setup-r-dependencies resolves the issue on the Windows CI; but, I don't think that's an optimal solution.

Build reference:

https://github.com/stanford-stats290/netid-package/actions/runs/11763068834/job/32766629444

Windows CI Check log
── R CMD build ─────────────────────────────────────────────────────────────────
* checking for file 'D:\a\netid-package\netid-package/DESCRIPTION' ... OK
* preparing 'netid':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
Error: --- re-building 'hello.qmd' using html
processing file: hello.qmd
1/13                  
2/13 [setup]          
Error in `library()`:
! there is no package called 'netid'
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
 16. base::withRestarts(...)
 17. base (local) withRestartList(expr, restarts)
 18. base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
 19. base (local) docall(restart$handler, restartArgs)
 21. evaluate (local) fun(base::quote(`<pckgNtFE>`))
Quitting from lines 11-12 [setup] (hello.qmd)
Execution halted
Error: Error: processing vignette 'hello.qmd' failed with diagnostics:
✖ Error running quarto cli.
Caused by error:
! System command 'quarto.exe' failed
--- failed re-building 'hello.qmd'
SUMMARY: processing the following file failed:
  'hello.qmd'
Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.
@cderv cderv self-assigned this Nov 12, 2024
@cderv
Copy link
Collaborator

cderv commented Nov 12, 2024

I re-ran the check on this repo and it passes https://github.com/quarto-dev/quarto-r/actions/runs/11798002514

We do use local::. though

- uses: r-lib/actions/setup-r-dependencies@v2
with:
# install the package itself as we register vignette engine
extra-packages: any::rcmdcheck, local::.
needs: check

And this is because of an "issue" in R I would say where an engine is registered to be used in R CMD Check only if the package is installed.
I can't find the references to this but this is something that is impacting all packages that register and uses the vignette engine directly

However, the issue you get in CI does not seem to be related to the quarto vignette engine not being registered...

So I think what happens is that the package netid is used in the vignette, so it should be loaded by R when called inside Quarto. This means R process needs to find it in lib path and it seems R CMD check in installing the package in a way that this is not passed to the quarto sub process.

I wonder if I can detect the information, and pass it to the vignette engine when this is run in R CMD check context... 🤔

@cderv
Copy link
Collaborator

cderv commented Nov 12, 2024

It seems R CMD build will use a lib dir in a temporary folder and install package there
https://github.com/wch/r-source/blob/f50aab97c98615643db276bb034701816ab43143/src/library/tools/R/build.R#L254-L261

It seems I would need to use R_BUILD_TEMPLIB as the information is recorded there...
https://github.com/wch/r-source/blob/f50aab97c98615643db276bb034701816ab43143/src/library/tools/R/build.R#L232

But it seems to be undocumented environment variable, so maybe this should not be used directly. 🤔

@cderv
Copy link
Collaborator

cderv commented Nov 12, 2024

Though it is setting R_LIBS so I don't know why the package would not be found 🤔
https://github.com/wch/r-source/blob/f50aab97c98615643db276bb034701816ab43143/src/library/tools/R/build.R#L293-L300

I'll check that first.

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

No branches or pull requests

2 participants