Skip to content

Commit 46d71b0

Browse files
authored
Merge pull request #12108 from quarto-dev/gha/cache-update
2 parents a0ff13f + a2d7a3c commit 46d71b0

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.github/actions/cache-typst/action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ outputs:
99
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
1010
cache-matched-key:
1111
description: "Key of the cache found and used."
12-
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
12+
value: ${{ steps.cache-typst-restore.outputs.cache-matched-key }}
1313
cache-path:
1414
description: "where is the packages cache for typst ?"
1515
value: ${{ steps.cache-typst-path.outputs.TYPST_CACHE }}
@@ -22,20 +22,21 @@ runs:
2222
run: |
2323
case $RUNNER_OS in
2424
"Linux")
25-
echo "TYPST_CACHE=${XDG_CACHE_HOME:-~/.cache}/typst/packages/" >> $GITHUB_ENV
25+
typst_cache="${XDG_CACHE_HOME:-~/.cache}/typst/packages/"
2626
;;
2727
"macOS")
28-
echo "TYPST_CACHE=~/Library/Caches/typst/packages/" >> $GITHUB_ENV
28+
typst_cache="~/Library/Caches/typst/packages/"
2929
;;
3030
"Windows")
31-
echo "TYPST_CACHE=$LOCALAPPDATA/typst/packages/" >> $GITHUB_ENV
31+
typst_cache="$LOCALAPPDATA/typst/packages/"
3232
;;
3333
*)
3434
echo "$RUNNER_OS not supported"
3535
exit 1
3636
;;
3737
esac
38-
echo "TYPST_CACHE=${TYPST_CACHE}" >> $GITHUB_OUTPUT
38+
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_ENV
39+
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_OUTPUT
3940
shell: bash
4041

4142
- name: Cache Typst package folder

.github/workflows/test-smokes.yml

Lines changed: 21 additions & 9 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'
@@ -291,15 +293,25 @@ jobs:
291293
path: tests/timing-for-ci.txt
292294

293295
- name: Save Typst cache
294-
if: always()
296+
if: always() && steps.cache-typst.outputs.cache-hit != 'true'
295297
uses: actions/cache/save@v4
296298
with:
297299
key: ${{ steps.cache-typst.outputs.cache-primary-key }}
298300
path: ${{ steps.cache-typst.outputs.cache-path }}
299301

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+
300312
- uses: actions/upload-artifact@v4
301-
# PLaywright test only runs on Linux for now
302-
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/**/*') != '' }}
303315
with:
304316
name: playwright-report
305317
path: ./tests/integration/playwright/playwright-report/

0 commit comments

Comments
 (0)