@@ -81,17 +81,35 @@ jobs:
81
81
name : Doctest Cabal
82
82
runs-on : ubuntu-latest
83
83
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
85
95
with :
86
96
path : ~/.local/state/cabal
87
- key : linux-store-doctest
97
+ key : linux-store-doctest-${{ env.DATE }}
98
+ restore-keys : linux-store-doctest
88
99
- name : Update Hackage index
89
100
run : cabal v2-update
90
101
- uses : actions/checkout@v4
91
102
- name : Install doctest
92
103
run : make doctest-install
93
104
- name : Doctest
94
105
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
+
95
113
buildinfo :
96
114
name : Check Field Syntax Reference
97
115
runs-on : ubuntu-latest
0 commit comments