Skip to content

Commit

Permalink
Merge pull request #12108 from quarto-dev/gha/cache-update
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv authored Feb 20, 2025
2 parents a0ff13f + a2d7a3c commit 46d71b0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
11 changes: 6 additions & 5 deletions .github/actions/cache-typst/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ outputs:
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
cache-matched-key:
description: "Key of the cache found and used."
value: ${{ steps.cache-typst-restore.outputs.cache-primary-key }}
value: ${{ steps.cache-typst-restore.outputs.cache-matched-key }}
cache-path:
description: "where is the packages cache for typst ?"
value: ${{ steps.cache-typst-path.outputs.TYPST_CACHE }}
Expand All @@ -22,20 +22,21 @@ runs:
run: |
case $RUNNER_OS in
"Linux")
echo "TYPST_CACHE=${XDG_CACHE_HOME:-~/.cache}/typst/packages/" >> $GITHUB_ENV
typst_cache="${XDG_CACHE_HOME:-~/.cache}/typst/packages/"
;;
"macOS")
echo "TYPST_CACHE=~/Library/Caches/typst/packages/" >> $GITHUB_ENV
typst_cache="~/Library/Caches/typst/packages/"
;;
"Windows")
echo "TYPST_CACHE=$LOCALAPPDATA/typst/packages/" >> $GITHUB_ENV
typst_cache="$LOCALAPPDATA/typst/packages/"
;;
*)
echo "$RUNNER_OS not supported"
exit 1
;;
esac
echo "TYPST_CACHE=${TYPST_CACHE}" >> $GITHUB_OUTPUT
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_ENV
echo "TYPST_CACHE=${typst_cache}" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Typst package folder
Expand Down
30 changes: 21 additions & 9 deletions .github/workflows/test-smokes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,16 @@ jobs:
cat("r-version=", R.Version()$version.string, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v4
- name: Restore Renv package cache
id: cache-renv-packages-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-${{ hashFiles('tests/renv.lock') }}
path: |
${{ env.RENV_PATHS_ROOT }}
renv/library
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-3-${{ hashFiles('tests/renv.lock') }}
restore-keys: |
${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-
save-always: ${{ inputs.extra-r-packages == '' }} # don't save cache if we have extra R packages
${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-3-
- name: Install missing system deps
if: runner.os == 'Linux'
Expand Down Expand Up @@ -291,15 +293,25 @@ jobs:
path: tests/timing-for-ci.txt

- name: Save Typst cache
if: always()
if: always() && steps.cache-typst.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-typst.outputs.cache-primary-key }}
path: ${{ steps.cache-typst.outputs.cache-path }}

- name: Save Renv package cache
# don't save cache if we have extra R packages
if: ${{ always() && steps.cache-renv-packages-restore.outputs.cache-hit != 'true' && inputs.extra-r-packages == '' }}
uses: actions/cache/save@v4
with:
path: |
${{ env.RENV_PATHS_ROOT }}
renv/library
key: ${{ steps.cache-renv-packages-restore.outputs.cache-primary-key }}

- uses: actions/upload-artifact@v4
# PLaywright test only runs on Linux for now
if: ${{ !cancelled() && runner.os != 'Windows' }}
# Upload pLaywright test report if they exists (playwright is only running on Linux for now)
if: ${{ !cancelled() && runner.os != 'Windows' && hashFiles('tests/integration/playwright/playwright-report/**/*') != '' }}
with:
name: playwright-report
path: ./tests/integration/playwright/playwright-report/
Expand Down

0 comments on commit 46d71b0

Please sign in to comment.