Skip to content

test cache

test cache #238

Workflow file for this run

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 }}
steps:
- uses: actions/checkout@v4
- name: Change ownership of /github/home
run: sudo chown -R $(whoami) /github/home
- 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: Setup Python and virtual environment using requirements file
# id: setup-python-venv
# uses: srvanderplas/[email protected]
# with:
# python-version-file: '.python-version'
# cache-dependency-path: requirements.txt
# install-cmd: "./py-deps -i"
# - name: Test
# run: |
# echo $RETICULATE_PYTHON;
# echo $RETICULATE_PYTHON_ENV;
# echo "$pythonLocation" >> $GITHUB_PATH;
#
- name: Renv setup
uses: r-lib/actions/setup-renv@v2
- name: Renv and R install status
shell: Rscript {0}
run: |
renv::status()
renv::diagnostics()
- name: Setup Python/venv with reqs file in reticulate
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="requirements.txt")
reticulate::use_virtualenv("venv")
reticulate::py_config()
writeLines(
paste0("RETICULATE_PYTHON=", reticulate::virtualenv_python("venv")),
Sys.getenv("GITHUB_ENV"))
writeLines(
paste0("PY_CACHE_STR=python",
paste(
readLines(".python-version"),
reticulate::virtualenv_python("venv"),
digest::digest(readLines("requirements.txt"))
)),
Sys.getenv("GITHUB_ENV"))
- name: Reticulate checks
shell: Rscript {0}
run: |
devtools::session_info()
reticulate::py_config()
- uses: actions/cache@v4 # v4.0.0
id: cache-venv
with:
path: .virtualenvs/r-reticulate
key: setup-venv-${{ runner.os }}-${{ env.PY_CACHE_STR }}
- 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