Skip to content

Commit 875dca3

Browse files
author
Susan Vanderplas
committed
Try to cache things in reticulate
1 parent 56f02bb commit 875dca3

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/main.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,35 @@ jobs:
6363
run: |
6464
reticulate::install_python(version=readLines(".python-version"))
6565
reticulate::py_install(c("virtualenv"))
66-
reticulate::virtualenv_root(".")
66+
reticulate::virtualenv_root()
6767
reticulate::virtualenv_create("venv", requirements="requirements.txt")
6868
reticulate::use_virtualenv("venv")
69+
writeLines(
70+
paste0("RETICULATE_PYTHON=", reticulate::virtualenv_python("venv")),
71+
Sys.getenv("GITHUB_ENV"))
72+
writeLines(
73+
paste0("PY_CACHE_STR=python",
74+
paste(
75+
readLines(".python-version"),
76+
reticulate::virtualenv_python("venv"),
77+
digest::digest(readLines("requirements.txt"))
78+
)),
79+
Sys.getenv("GITHUB_ENV"))
80+
81+
6982
7083
- name: Reticulate checks
7184
shell: Rscript {0}
7285
run: |
7386
devtools::session_info()
7487
reticulate::py_config()
7588
89+
- uses: actions/cache@v4 # v4.0.0
90+
id: cache-venv
91+
with:
92+
path: ${{ env.RETICULATE_PYTHON }}
93+
key: setup-venv-${{ runner.os }}-${{ env.PY_CACHE_STR }}
94+
7695
- uses: quarto-dev/quarto-actions/setup@v2
7796
with:
7897
version: 1.5.57

0 commit comments

Comments
 (0)