Skip to content

Commit 455f78d

Browse files
authored
Merge pull request #12129 from quarto-dev/backport/gha-update
2 parents 21a364e + e0466b7 commit 455f78d

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
1-
name: "Cache Typst package"
1+
name: "Restore any Typst package cache"
22
description: "Configures the caching for Typst packages"
3+
outputs:
4+
cache-hit:
5+
description: "Was a cache found with primary key ?"
6+
value: ${{ steps.cache-typst-restore.outputs.cache-hit }}
7+
cache-primary-key:
8+
description: "Key of the cache to find and save"
9+
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
10+
cache-matched-key:
11+
description: "Key of the cache found and used."
12+
value: ${{ steps.cache-typst-restore.outputs.cache-matched-key }}
13+
cache-path:
14+
description: "where is the packages cache for typst ?"
15+
value: ${{ steps.cache-typst-path.outputs.TYPST_CACHE }}
316

417
runs:
518
using: "composite"
619
steps:
720
- name: Typst Cache path
21+
id: cache-typst-path
822
run: |
923
case $RUNNER_OS in
1024
"Linux")
11-
echo "TYPST_CACHE=${XDG_CACHE_HOME:-~/.cache}/typst/packages/" >> $GITHUB_ENV
25+
typst_cache="${XDG_CACHE_HOME:-~/.cache}/typst/packages/"
1226
;;
1327
"macOS")
14-
echo "TYPST_CACHE=~/Library/Caches/typst/packages/" >> $GITHUB_ENV
28+
typst_cache="~/Library/Caches/typst/packages/"
1529
;;
1630
"Windows")
17-
echo "TYPST_CACHE=$LOCALAPPDATA/typst/packages/" >> $GITHUB_ENV
31+
typst_cache="$LOCALAPPDATA/typst/packages/"
1832
;;
1933
*)
2034
echo "$RUNNER_OS not supported"
2135
exit 1
2236
;;
2337
esac
38+
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_ENV
39+
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_OUTPUT
2440
shell: bash
2541

2642
- name: Cache Typst package folder
27-
uses: actions/cache@v4
43+
id: cache-typst-restore
44+
uses: actions/cache/restore@v4
2845
with:
2946
path: ${{ env.TYPST_CACHE }}
30-
key: ${{ runner.os }}-typst-1-${{ github.run_id }}
47+
key: ${{ runner.os }}-typst-1
3148
restore-keys: |
32-
${{ runner.os }}-typst-1-
33-
save-always: true
49+
${{ runner.os }}-typst-

.github/workflows/test-smokes.yml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,16 @@ jobs:
105105
cat("r-version=", R.Version()$version.string, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
106106
shell: Rscript {0}
107107

108-
- name: Cache R packages
109-
uses: actions/cache@v4
108+
- name: Restore Renv package cache
109+
id: cache-renv-packages-restore
110+
uses: actions/cache/restore@v4
110111
with:
111-
path: ${{ env.RENV_PATHS_ROOT }}
112-
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-${{ hashFiles('tests/renv.lock') }}
112+
path: |
113+
${{ env.RENV_PATHS_ROOT }}
114+
renv/library
115+
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-3-${{ hashFiles('tests/renv.lock') }}
113116
restore-keys: |
114-
${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-
115-
save-always: ${{ inputs.extra-r-packages == '' }} # don't save cache if we have extra R packages
117+
${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-3-
116118
117119
- name: Install missing system deps
118120
if: runner.os == 'Linux'
@@ -130,8 +132,8 @@ jobs:
130132
renv::restore()
131133
# Install dev versions for our testing
132134
# Use r-universe to avoid github api calls
133-
try(install.packages('knitr', repos = 'https://yihui.r-universe.dev'))
134-
try(install.packages('rmarkdown', repos = 'https://rstudio.r-universe.dev'))
135+
try(install.packages('rmarkdown', repos = c('https://rstudio.r-universe.dev', getOption('repos'))))
136+
try(install.packages('knitr', repos = c('https://yihui.r-universe.dev', getOption('repos'))))
135137
if ('${{ inputs.extra-r-packages }}' != '') {
136138
cat(sprintf("::notice::Running with the following extra R packages for pak: %s\n", "${{ inputs.extra-r-packages }}"))
137139
renv::install(strsplit("${{ inputs.extra-r-packages }}", split = ",")[[1]])
@@ -143,7 +145,7 @@ jobs:
143145
- name: Install uv for Python
144146
uses: astral-sh/setup-uv@v3
145147
with:
146-
version: "0.4.30"
148+
version: "0.5.9"
147149
enable-cache: true
148150
cache-dependency-glob: "tests/uv.lock"
149151

@@ -161,6 +163,7 @@ jobs:
161163
quarto install tinytex
162164
163165
- name: Cache Typst packages
166+
id: cache-typst
164167
uses: ./.github/actions/cache-typst
165168

166169
- name: Install Chrome
@@ -169,7 +172,7 @@ jobs:
169172
- name: Setup Julia
170173
uses: julia-actions/setup-julia@v2
171174
with:
172-
version: "1.10"
175+
version: "1.11.3"
173176

174177
- name: Cache Julia Packages
175178
uses: julia-actions/cache@v2
@@ -183,7 +186,7 @@ jobs:
183186
export JUPYTER=$(find $(dirname $(uv run --frozen which jupyter))/ -type f -name "jupyter.exe" -o -name "jupyter")
184187
uv run --frozen julia --color=yes --project=. -e "import Pkg; Pkg.instantiate(); Pkg.build(\"IJulia\"); Pkg.precompile()"
185188
echo "Julia Jupyter:"
186-
julia --project=. -e "import IJulia;println(IJulia.JUPYTER);println(IJulia.find_jupyter_subcommand(\"notebook\"))"
189+
uv run julia --project=. -e "import IJulia;println(IJulia.JUPYTER);println(IJulia.find_jupyter_subcommand(\"notebook\"))"
187190
188191
- name: Setup timing file for timed test
189192
if: ${{ matrix.time-test == true }}
@@ -289,9 +292,26 @@ jobs:
289292
name: timed test file
290293
path: tests/timing-for-ci.txt
291294

295+
- name: Save Typst cache
296+
if: always() && steps.cache-typst.outputs.cache-hit != 'true'
297+
uses: actions/cache/save@v4
298+
with:
299+
key: ${{ steps.cache-typst.outputs.cache-primary-key }}
300+
path: ${{ steps.cache-typst.outputs.cache-path }}
301+
302+
- name: Save Renv package cache
303+
# don't save cache if we have extra R packages
304+
if: ${{ always() && steps.cache-renv-packages-restore.outputs.cache-hit != 'true' && inputs.extra-r-packages == '' }}
305+
uses: actions/cache/save@v4
306+
with:
307+
path: |
308+
${{ env.RENV_PATHS_ROOT }}
309+
renv/library
310+
key: ${{ steps.cache-renv-packages-restore.outputs.cache-primary-key }}
311+
292312
- uses: actions/upload-artifact@v4
293-
# PLaywright test only runs on Linux for now
294-
if: ${{ !cancelled() && runner.os != 'Windows' }}
313+
# Upload pLaywright test report if they exists (playwright is only running on Linux for now)
314+
if: ${{ !cancelled() && runner.os != 'Windows' && hashFiles('tests/integration/playwright/playwright-report/**/*') != '' }}
295315
with:
296316
name: playwright-report
297317
path: ./tests/integration/playwright/playwright-report/

0 commit comments

Comments
 (0)