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

Error when building quarto articles on GH actions #2733

Open
DanChaltiel opened this issue Jul 25, 2024 · 8 comments
Open

Error when building quarto articles on GH actions #2733

DanChaltiel opened this issue Jul 25, 2024 · 8 comments

Comments

@DanChaltiel
Copy link

DanChaltiel commented Jul 25, 2024

Hi,

I tried setting up quarto vignettes, and while it works perfectly on my computer (local), I could not manage to make it work on GH actions.
Locally, even pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) works fine.

For instance, this is the last run I had:
https://github.com/DanChaltiel/EDCimport/actions/runs/10092641396/job/27907083693#step:7:393
image
Here is the workflow: https://github.com/DanChaltiel/EDCimport/actions/runs/10092641396/workflow
I hope I did it correctly, but at least I can say that the error message is not specific enough to let me debug this.
Note that my vignette uses tabsets.min.js to have tabs.

BTW, it would be nice to reference a minimal reproducible example in the vignette, so that we could simply grab the .qmd file, test that it runs on our setup, and then incrementally change our article it to make what we want.

@hadley
Copy link
Member

hadley commented Jul 25, 2024

@DanChaltiel could you please file the example rendering as a separate issue? For that it would be super useful if you could include a minimal qmd that illustrated the problem. Thanks!

@DanChaltiel
Copy link
Author

I'm not sure what you meant, but I tried to add minimal vignettes to see which would fail.
Here is the output: https://github.com/DanChaltiel/EDCimport/actions/runs/10107819848/job/27952452580#step:7:385
aaaaa_test_1.qmd is the exact copy of https://raw.githubusercontent.com/r-lib/pkgdown/main/vignettes/quarto.qmd and still fails.

I'd gladly give you more information but I'm a bit clueless on how to efficiently debug GHActions.

I separated the formula bug in the vignette into another issue as requested.

@olivroy
Copy link
Collaborator

olivroy commented Jul 26, 2024

@DanChaltiel You could try adding tinytex: true in the setup quarto action. You also no longer the pre-release version of Quarto. (They are starting veresion 1.6. It may (or may not) be unstable at the early stage.

Maybe try replacing this in https://github.com/DanChaltiel/EDCimport/blob/b7e63cced82bdaf00deb1fc8367c5c978faa8f5e/.github/workflows/pkgdown.yaml#L30-L35

      - uses: quarto-dev/quarto-actions/setup@v2
        with:
          tinytex: true
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@DanChaltiel
Copy link
Author

@olivroy
Copy link
Collaborator

olivroy commented Jul 26, 2024

Ok, but I see that this is an article. (i.e. in the vignettes/articles folder as opposed to vignettes/)
https://github.com/DanChaltiel/EDCimport/blob/main/vignettes/articles/adverse_events.qmd

If you want it to be a vignette, place it in the vignettes/ folder directly.
If you want it to be an article, don't use the vignette declaration.

Use

---
title: "Adverse Events"
description: > 
  Learn how to make AE tables.
format: html
knitr:
  opts_chunk: 
    collapse: true
    comment: '#>'
---

Not sure if this will solve the issue, but it may help.

I have been able to setup Quarto articles in gt. https://github.com/rstudio/gt/blob/master/.github/workflows/pkgdown.yaml

@DanChaltiel
Copy link
Author

DanChaltiel commented Jul 26, 2024

@olivroy How dumb of me, that was the problem! Thank you very much :-)

@hadley feel free to close this issue, but maybe the error message could be a bit more helpful. There also could be a check that articles don't have a vignette declaration.

@ethanbass
Copy link

ethanbass commented Oct 13, 2024

I think the issue with Quarto articles is because they are being built by quarto_render into the articles subdirectory of the vignettes temp directory, but build_quarto_articles is expecting to find the articles in the vignettes folder when it renders them into the pkgdown template, causing the error: "No built file found for ".

For example, if you clone my test package from github (https://github.com/ethanbass/quartoArticleError) and run pkgdown::build_articles() you get the 'no built file' error.

However, Quarto articles build correctly if you modify build_quarto articles so that it moves the contents of the articles folder to the parent vignettes directory after rendering, e.g.,

  output_dir <- quarto_render(pkg, src_path, quiet = quiet)
  article_dir <- fs::path(output_dir,"articles")
  if (fs::dir_exists(article_dir)){
    fs::file_move(dir_ls(article_dir), output_dir)
  }

After installing my patched version with the above modification, quarto articles are built correctly.

devtools::install_github("ethanbass/pkgdown", ref="qmd_articles")
pkgdown::build_articles()

Using my patched pkgdown, the quarto article also builds on github actions correctly (see https://github.com/ethanbass/quartoArticleError/actions/runs/11316616971/job/31469099510 and https://ethanbass.github.io/quartoArticleError/articles/quarto-article.html)

Alternatively, I thought of modifying the path_out in the qmds object generated within build_quarto_articles but that seemed to create other downstream problems with the rendering of the pkgdown site. Maybe there is also a way to change the quarto_render so that it builds all the files directly into the vignettes directory, but so far I haven't been able to figure that out?

Edit: To clarify, this is only an issue if the source of your article lives in the "articles" subdirectory, as is done automatically when using usethis::use_article to generate articles.

@acastroaraujo
Copy link

@ethanbass Thank you so much. I thought I was losing my mind.

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

5 participants