Skip to content

Commit 117d6d6

Browse files
committed
CI: flatten the key restore structure
Docs: > The cache action first searches for cache hits for `key` and `restore-keys` in the branch containing the workflow run. If there are no hits in the current branch, the cache action searches for `key` and `restore-keys` in the parent branch and upstream branches. So the `key` matches first in any case & scenario. & because `*-bench-*` was proven to be superflous & so removed - now we have only 1 namespace to search through. & so we arrived at this simple solution (it is also exactly the way how cache nicely works in repositories I manage).
1 parent 838e01d commit 117d6d6

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

.github/workflows/bench.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ jobs:
5050
path: |
5151
~/.cabal/packages
5252
~/.cabal/store
53-
restore-keys: |
54-
v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
55-
v2-${{ runner.os }}-${{ matrix.ghc }}-build-
56-
v2-${{ runner.os }}-${{ matrix.ghc }}
53+
restore-keys: v2-${{ runner.os }}-${{ matrix.ghc }}-build-
5754

5855
- run: cabal update
5956

.github/workflows/cache-deps.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ jobs:
100100
${{ env.CABAL_PKGS_DIR }}
101101
${{ env.CABAL_STORE_DIR }}
102102
key: v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
103-
restore-keys: |
104-
v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
105-
v2-${{ runner.os }}-${{ matrix.ghc }}-build-
106-
v2-${{ runner.os }}-${{ matrix.ghc }}
103+
restore-keys: v2-${{ runner.os }}-${{ matrix.ghc }}-build-
107104

108105
- run: cabal update
109106

.github/workflows/test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ jobs:
122122
path: |
123123
${{ env.CABAL_PKGS_DIR }}
124124
${{ env.CABAL_STORE_DIR }}
125-
key: v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
126-
restore-keys: |
127-
v2-${{ runner.os }}-${{ matrix.ghc }}-build-
128-
v2-${{ runner.os }}-${{ matrix.ghc }}
125+
restore-keys: v2-${{ runner.os }}-${{ matrix.ghc }}-build-
129126

130127
- run: cabal update
131128

0 commit comments

Comments
 (0)