I took a stab at making a Github action that renders the contents of a repo. I'm definitely no actions expert, but I tested rendering R documents and Python documents  `windows-latest` and `ubuntu-latest`. Short story: R was fine, but I ran into issue with Python because of the same Jupyter error I was seeing earlier last week. See the example workflows [here](https://github.com/pommevilla/quarto-action-tests/tree/main/.github/workflows).

Once the action is made, if the user wants to use it, they will have to supply a list of packages that they're using in their documents so that Quarto can actually render them. Python makes that easy with `pip freeze > requirements.txt`, and we can use `Renv` lockfiles to handle that for R. I haven't done much work with Julia, but it looks like we can do [something similar](https://discourse.julialang.org/t/install-a-packages-from-a-list/30920) ([also here](https://discourse.julialang.org/t/installing-packages-from-a-list/20450)). 

There may be some errors in installing packages depending on what OS the user is writing on. For instance, I wrote [these examples](https://github.com/pommevilla/quarto-action-tests) on a Windows machine. When I went to test on `ubuntu-latest`, it ran into an error because `pywin32` and `pywinpty` are Windows-only packages and won't install on Ubuntu. We can get around this either by structuring the requirements [like this](https://github.com/pommevilla/quarto-action-tests/tree/main/requirements) and calling the `pip install` command accordingly or by just parsing requirement files for platform-specific packages.

There will also probably be errors if the packages that the person is using is not found on CRAN, PyPI, or whatever the Julia equivalent is.

Rendering R Markdown documents seems to work fine.  Here is an [example workflow](https://github.com/pommevilla/quarto-action-tests/blob/main/.github/workflows/min-r.yml) I wrote that installs the latest Quarto-CLI (hardcoded for now), restores the R packages used via `Renv`, and renders the RMarkdown file. Just a note that sometimes this Install packages step took a long time for the R case, sometimes upwards of 10 minutes. There's also an example step at the bottom that pushes the new renders to the repo. 

I only tested R on Ubuntu because setting up Quarto through Github Actions was...challenging. I originally tried to do silent install via `msiexec`, but I wasn't able to get the options I found via Orca to work. I eventually ended up using Christophe's [scoop bucket](https://github.com/cderv/r-bucket) to get it to work on `windows-latest`, but then `scoop` wasn't persisting between steps, so I had to make everything into one big step and it kind of sucks. This is my first time writing actions, though, so I'm probably forgetting something. 

Quarto's having problems rendering Python, though, and it's the same error I was experiencing with running `quarto` commands on Windows outside of the symbolic link that the development version of `quarto-cli` sets up - `quarto` is unable to start up a Jupyter kernel, producing this error:

![image](https://user-images.githubusercontent.com/6981612/121795485-0d829180-cbd7-11eb-96ce-fad3e9c89a39.png)

I reproduced this problem on [Linux ](https://github.com/pommevilla/quarto-action-tests/blob/main/.github/workflows/min-linux-python.yml) and [Windows](https://github.com/pommevilla/quarto-action-tests/blob/main/.github/workflows/min-windows-python.yml) (I had to make it all one big step in the Windows workflow because `scoop` wasn't persisting between steps for some reason).

I remember that this error has to do with Quarto starting a Jupyter daemon in the background - I just wanted to share this issue so everyone's aware of it. 




2021-06-13T04:52:22Z
pommevilla
closed
Notes on making a quarto-render Github Action
https://github.com/quarto-dev/quarto-cli/issues/36