actions icon indicating copy to clipboard operation
actions copied to clipboard

Clear error message and workflow for R CMD checks with vignettes

Open mikeroswell opened this issue 3 years ago • 9 comments

Suddenly my package started failing checks, and I could tell there was a latex issue, but not what it was nor how to fix it. I would like a clear message about what is failing and pointers for how to fix it. I think a revised workflow (for packages with vignettes) could resolve this.

When there is an issue building vignettes, maybe point me to a workflow like the edited one I posted here? Thanks!!

mikeroswell avatar Feb 23 '22 14:02 mikeroswell

It is unlikely that we can help you if you don't show us the failed workflow.

gaborcsardi avatar Feb 23 '22 14:02 gaborcsardi

If you just want examples, this is quite prominent: https://github.com/r-lib/actions#examples

gaborcsardi avatar Feb 23 '22 15:02 gaborcsardi

Thanks for the quick replies!

Here is the workflow that started failing the GH action checks mysteriously 20 days ago, even though the package was passing checks locally on my machine

mikeroswell avatar Feb 23 '22 15:02 mikeroswell

And the error message from one of the failed runs:

Run rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
── R CMD build ─────────────────────────────────────────────────────────────────
pdflatex not found! Not building PDF manual.
* checking for file ‘.../DESCRIPTION’ ... OK
* preparing ‘MeanRarity’:
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
Loading required namespace: MeanRarity
* saving partial Rd database
* creating vignettes ... ERROR
Error: --- re-building ‘Estimating_Mean_Rarity.Rmd’ using rmarkdown
--- finished re-building ‘Estimating_Mean_Rarity.Rmd’
--- re-building ‘Gods_estimator.Rmd’ using rmarkdown
--- finished re-building ‘Gods_estimator.Rmd’
--- re-building ‘Using_MeanRarity.Rmd’ using rmarkdown
Warning in system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  error in running command
! sh: xelatex: command not found
Error: Error: processing vignette 'Using_MeanRarity.Rmd' failed with diagnostics:
LaTeX failed to compile /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpEfSnLF/Rbuildd624e3fd844/MeanRarity/vignettes/Using_MeanRarity.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Using_MeanRarity.log for more info.
--- failed re-building ‘Using_MeanRarity.Rmd’
SUMMARY: processing the following file failed:
  ‘Using_MeanRarity.Rmd’
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.

mikeroswell avatar Feb 23 '22 15:02 mikeroswell

In case it wasn't clear, I was apparently able to resolve the issue by adding - uses: r-lib/actions/setup-tinytex@v2 right before - uses: r-lib/actions/check-r-package@v1 in the revised workflow...

I could tell the issue was a Latex one but didn't know I should add this line to install missing Tex pieces (if that's what this action does).

mikeroswell avatar Feb 23 '22 15:02 mikeroswell

In the list of actions at https://github.com/r-lib/actions#github-actions-for-the-r-language you can see that setup-tinytex sets up LaTeX. Should it say that if you don't use that then there is no LaTex?

PRs to improve the docs are always welcome.

gaborcsardi avatar Feb 23 '22 15:02 gaborcsardi

I think it's very clear there, actually!

The place that at least I got caught up was in seeing that the default for the R-CMD-check workflow didn't include this, but it was critical... I assumed erroneously that the error was probably caused by some technical problem in my .rmd file rather than simply failing to set up LaTex. I spent a while searching the errors (e.g. error in running command ! sh: xelatex: command not found) but took me a long time to realize I needed to change the workflow.

I don't know if your actions affect the GH action error messages, but if it said something like xelatex: command not found: did you set up tinytex correctly? see https://github.com/r-lib/actions/tree/v2/setup-tinytex I probably would have gotten there much faster!

Is this at all helpful? Sorry, I was totally bumbling about!!!

mikeroswell avatar Feb 23 '22 15:02 mikeroswell

One more comment in reply to your question: I think the documentation saying "if you don't use uses-tinytex then there is no LaTeX" needs to go at a higher level/ in the use_github_action() documentation to be helpful. Thanks!

mikeroswell avatar Feb 23 '22 15:02 mikeroswell

Would you like to submit a PR? (No pressure :)

gaborcsardi avatar Mar 16 '22 14:03 gaborcsardi

We can't easily change the error message, unfortunately. So maybe this is something that the usethis package could help with. E.g. suggest adding setup-tinytex if the package has a LaTeX vignette.

gaborcsardi avatar Oct 20 '22 07:10 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 Nov 04 '22 13:11 github-actions[bot]