From c489e75bf7d4c87a727fc48a865d7e227fc31e71 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Tue, 14 Nov 2023 12:19:07 +0100 Subject: [PATCH] [gha] Add caching for Typst package to avoid downloading from remote always --- .github/actions/cache-typst/action.yml | 32 ++++++++++++++++++++++++++ .github/workflows/test-smokes.yml | 3 +++ 2 files changed, 35 insertions(+) create mode 100644 .github/actions/cache-typst/action.yml diff --git a/.github/actions/cache-typst/action.yml b/.github/actions/cache-typst/action.yml new file mode 100644 index 00000000000..03a8a598d75 --- /dev/null +++ b/.github/actions/cache-typst/action.yml @@ -0,0 +1,32 @@ +name: "Cache Typst package" +description: "Configures the caching for Typst packages" + +runs: + using: "composite" + steps: + - name: Typst Cache path + run: | + case $RUNNER_OS in + "Linux") + echo "TYPST_CACHE=${XDG_CACHE_HOME:-~/.cache}/typst/packages/" >> $GITHUB_ENV + ;; + "macOS") + echo "TYPST_CACHE=~/Library/Caches/typst/packages/" >> $GITHUB_ENV + ;; + "Windows") + echo "TYPST_CACHE=$LOCALAPPDATA/typst/packages/" >> $GITHUB_ENV + ;; + *) + echo "$RUNNER_OS not supported" + exit 1 + ;; + esac + shell: bash + + - name: Cache Typst package folder + uses: actions/cache@v3 + with: + path: ${{ env.TYPST_CACHE }} + key: ${{ runner.os }}-typst-1-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-typst-1- diff --git a/.github/workflows/test-smokes.yml b/.github/workflows/test-smokes.yml index f09ac2799e4..20f9e39a808 100644 --- a/.github/workflows/test-smokes.yml +++ b/.github/workflows/test-smokes.yml @@ -142,6 +142,9 @@ jobs: run: | quarto install tinytex + - name: Cache Typst packages + uses: ./.github/actions/cache-typst + - name: Install Chrome uses: browser-actions/setup-chrome@latest