Skip to content

Commit bab8de3

Browse files
author
Susan Vanderplas
committed
Fix render and publish step
1 parent da706b7 commit bab8de3

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
cache-to: type=gha,mode=max
5858

5959
# Run inside the container against the mounted repo
60-
- name: Render & publish with cached renv/pip
60+
- name: Render & publish
6161
run: |
6262
docker run --rm \
6363
-v "${{ github.workspace }}:/project" \
@@ -75,18 +75,34 @@ jobs:
7575
local/quarto-reticulate:latest \
7676
/bin/sh -c '
7777
set -e
78-
# R deps from renv in setup/
78+
79+
echo "=== Checking renv cache path ==="
80+
ls -lah ${RENV_PATHS_CACHE} || echo "renv cache dir not found"
81+
82+
echo "=== Checking pip cache path ==="
83+
ls -lah ${PIP_CACHE_DIR} || echo "pip cache dir not found"
84+
85+
echo "=== Package count in renv cache before restore ==="
86+
Rscript -e "cat(length(list.files(Sys.getenv('RENV_PATHS_CACHE'), recursive=TRUE)), 'packages in cache\n')"
87+
88+
# Restore R packages from project root
7989
if [ -f "/project/renv.lock" ]; then
90+
echo "=== Restoring R packages with renv ==="
8091
Rscript -e "renv::restore(project = '/project', prompt = FALSE)"
8192
fi
82-
# Python deps
83-
if [ -f "/project/setup/requirements.txt" ]; then
93+
94+
echo "=== Package count in renv cache after restore ==="
95+
Rscript -e "cat(length(list.files(Sys.getenv('RENV_PATHS_CACHE'), recursive=TRUE)), 'packages in cache\n')"
96+
97+
# Restore Python packages
98+
if [ -f "/project/requirements.txt" ]; then
99+
echo "=== Restoring Python packages ==="
84100
python3 -m venv /root/.virtualenvs/venv
85101
/root/.virtualenvs/venv/bin/pip install --upgrade pip
86-
/root/.virtualenvs/venv/bin/pip install --cache-dir ${PIP_CACHE_DIR} -r /project/setup/requirements.txt
102+
/root/.virtualenvs/venv/bin/pip install --cache-dir ${PIP_CACHE_DIR} -r /project/requirements.txt
87103
export PATH=/root/.virtualenvs/venv/bin:$PATH
88104
fi
89-
# Quarto
105+
106+
# Render + publish
90107
cd /project
91-
quarto render && quarto publish
92-
'
108+
quarto render && quarto publish

Dockerfile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# Fast, sane base with R + tools
21
FROM rocker/verse:4.5
32

43
ENV DEBIAN_FRONTEND=noninteractive
5-
# Default cache locations (can be overridden at runtime)
64
ENV RENV_PATHS_CACHE=/root/.local/share/renv \
75
PIP_CACHE_DIR=/root/.cache/pip
86

9-
# --- Layer 1: OS deps (cacheable)
7+
# --- Layer 1: OS deps (cacheable with BuildKit)
108
RUN --mount=type=cache,target=/var/cache/apt \
119
--mount=type=cache,target=/var/lib/apt \
1210
apt-get update && apt-get install -y --no-install-recommends \
@@ -19,7 +17,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
1917
curl gnupg ca-certificates \
2018
&& rm -rf /var/lib/apt/lists/*
2119

22-
# --- Layer 2: GitHub CLI (optional)
20+
# --- Layer 2: GitHub CLI
2321
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
2422
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
2523
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
@@ -28,21 +26,18 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
2826
apt-get update && apt-get install -y gh && \
2927
rm -rf /var/lib/apt/lists/*
3028

31-
# --- Layer 3: Quarto
29+
# --- Layer 3: Quarto CLI
3230
RUN curl -fsSL https://quarto.org/download/latest/quarto-linux-amd64.deb -o /tmp/quarto.deb && \
3331
apt-get update && apt-get install -y /tmp/quarto.deb && rm -f /tmp/quarto.deb && \
3432
rm -rf /var/lib/apt/lists/*
3533

36-
# --- Layer 4: TinyTeX (LaTeX)
34+
# --- Layer 4: TinyTeX
3735
RUN Rscript -e "install.packages('tinytex', repos='https://cloud.r-project.org'); tinytex::install_tinytex()"
3836

39-
# Optional: a couple of helper R packages used during checks
40-
RUN Rscript -e "install.packages(c('digest'), repos='https://cloud.r-project.org')"
41-
42-
# Ensure cache dirs always exist (first-run safe)
37+
# Ensure cache dirs exist
4338
RUN mkdir -p ${RENV_PATHS_CACHE} ${PIP_CACHE_DIR} /root/.virtualenvs
4439

4540
WORKDIR /project
4641

47-
# Default command: render then publish
42+
# Default command: render and publish
4843
CMD ["/bin/sh","-c","quarto render && quarto publish"]

0 commit comments

Comments
 (0)