-
Notifications
You must be signed in to change notification settings - Fork 5
132 lines (117 loc) · 4.28 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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