Skip to content

Commit ba6f6ff

Browse files
committed
CI "Doctest Cabal": daily refresh of cache
1 parent 9a311bd commit ba6f6ff

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/quick-jobs.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,35 @@ jobs:
8181
name: Doctest Cabal
8282
runs-on: ubuntu-latest
8383
steps:
84-
- uses: actions/cache@v4
84+
# It is complicated to get a proper cache key for the dependencies of a package
85+
# (here: doctest) that we just `cabal install`.
86+
# So, as a heuristics we update the cache once per day.
87+
# Updating it with each run would be an alternative, but we a short of cache space,
88+
# and this would generate too many new caches.
89+
- name: Use date as cache key
90+
run: |
91+
echo "DATE=$(date +'%Y-%m-%d')" >> "${GITHUB_ENV}"
92+
- name: Restore cached dependencies
93+
uses: actions/cache/restore@v4
94+
id: cache
8595
with:
8696
path: ~/.local/state/cabal
87-
key: linux-store-doctest
97+
key: linux-store-doctest-${{ env.DATE }}
98+
restore-keys: linux-store-doctest
8899
- name: Update Hackage index
89100
run: cabal v2-update
90101
- uses: actions/checkout@v4
91102
- name: Install doctest
92103
run: make doctest-install
93104
- name: Doctest
94105
run: make doctest
106+
- name: Cache dependencies
107+
if: always() && steps.cache.outputs.cache-hit != 'true'
108+
uses: actions/cache/save@v4
109+
with:
110+
path: ~/.local/state/cabal
111+
key: ${{ steps.cache.outputs.cache-primary-key }}
112+
95113
buildinfo:
96114
name: Check Field Syntax Reference
97115
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)