Fix rendering issues #298
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Render and deploy Quarto files | |
on: | |
push: | |
pull_request: | |
jobs: | |
quarto-render-and-deploy: | |
runs-on: ubuntu-latest | |
container: rocker/verse:latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_PAT: ${{ secrets.GH_PAT }} | |
GITHUB_PAT: ${{ secrets.GH_PAT }} | |
PYENV_PATHS_ROOT: '~/.pyenv' | |
PYENV_PATHS_VENV: '~/.virtualenvs/venv' | |
PYENV_PATHS_RETICULATE: '~/.local/share/r-reticulate' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update | |
sudo apt upgrade | |
sudo apt install -y libudunits2-dev libgdal-dev | |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | |
&& sudo apt update \ | |
&& sudo apt install gh -y | |
shell: /bin/bash {0} | |
- name: Renv setup | |
uses: r-lib/actions/setup-renv@v2 | |
- name: Renv and R install status | |
shell: Rscript {0} | |
run: | | |
renv::status() | |
renv::diagnostics() | |
# Paste string to describe cache | |
writeLines( | |
paste0("PY_CACHE_STR=python", | |
paste( | |
readLines(".python-version"), | |
digest::digest(readLines("pyenv/requirements.txt")), | |
sep = "-" | |
)), | |
Sys.getenv("GITHUB_ENV")) | |
- name: Restore reticulate cache | |
id: restore-reticulate-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.PYENV_PATHS_RETICULATE }} | |
key: local-share-reticulate-${{ env.PY_CACHE_STR }} | |
restore-keys: local-share-reticulate- | |
- name: Restore venv cache | |
id: restore-venv-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.PYENV_PATHS_VENV }} | |
key: pyenv-${{ env.PY_CACHE_STR }} | |
restore-keys: pyenv- | |
- name: Restore pyenv cache | |
id: restore-pyenv-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.PYENV_PATHS_ROOT }} | |
key: reticulate-venv-${{ env.PY_CACHE_STR }} | |
restore-keys: reticulate-venv- | |
- name: Setup Python/venv with reqs file in reticulate | |
if: ${{ steps.restore-pyenv-cache.outputs.cache-hit != 'true' && steps.restore-venv-cache.outputs.cache-hit != 'true' && steps.restore-reticulate-cache.outputs.cache-hit != 'true' }} | |
id: setup-reticulate-venv | |
shell: Rscript {0} | |
run: | | |
reticulate::install_python(version=readLines(".python-version")) | |
reticulate::py_install(c("virtualenv")) | |
reticulate::virtualenv_root() | |
reticulate::virtualenv_create("venv", requirements="pyenv/requirements.txt") | |
reticulate::use_virtualenv("venv") | |
reticulate::py_config() | |
# Set reticulate_python env var | |
writeLines( | |
paste0("RETICULATE_PYTHON=", reticulate::virtualenv_python("venv")), | |
Sys.getenv("GITHUB_ENV")) | |
# Paste string to describe cache | |
writeLines( | |
paste0("PY_CACHE_STR=python", | |
paste( | |
readLines(".python-version"), | |
digest::digest(readLines("pyenv/requirements.txt")), | |
sep = "-" | |
)), | |
Sys.getenv("GITHUB_ENV")) | |
- name: Reticulate checks | |
shell: Rscript {0} | |
run: | | |
devtools::session_info() | |
reticulate::py_config() | |
- uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
version: 1.5.57 | |
tinytex: true | |
- name: Render Quarto Project | |
shell: /bin/bash {0} | |
run: | | |
quarto render --execute-debug | |
- name: "Deploy to gh-pages" | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
- name: Broken Link Check | |
uses: technote-space/broken-link-checker-action@v2 | |
with: | |
RECURSIVE: false |