ci: Improve cache keys and their restore prefixes

The cache key for nix now depends on default.nix and shell.nix in the root folder and all
.patch files in the nix folder. Those may change the output of our nix derivations, so
must be included. At the same time, there is no reason to include the actions/setup-nix
folder. This would only lead to new caches being created every time we update one of the
dependent actions in this file. Finally, we never restore caches with a different id any-
more. There is no point in having the style job fall back to the static cache for example.

The cache keys for cabal can be more explicit: We only have one postgrest.cabal and one
relevant cabal.project file. We were missing the cabal.project.freeze file, though, which
affects the dependencies used, too.
This commit is contained in:
Wolfgang Walther
2024-02-09 18:43:53 +01:00
parent f9ee1f7e73
commit 066fa8b6aa
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -20,11 +20,9 @@ runs:
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v4.0.3
with:
key: cache-nix-${{ runner.os }}-id-${{ inputs.cache-id }}-${{ hashFiles('nix/**/*.nix', '.github/actions/setup-nix/*') }}
key: cache-nix-${{ runner.os }}-${{ inputs.cache }}-${{ hashFiles('**/*.nix', 'nix/**/*.patch') }}
restore-keys: |
cache-nix-${{ runner.os }}-id-${{ inputs.cache-id }}-
cache-nix-${{ runner.os }}-id-common-
cache-nix-${{ runner.os }}-
cache-nix-${{ runner.os }}-${{ inputs.cache }}-
- uses: cachix/cachix-action@v14
with:
name: postgrest
+1 -1
View File
@@ -273,7 +273,7 @@ jobs:
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: cache-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project') }}
key: cache-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }}
restore-keys: |
cache-cabal-${{ runner.os }}-${{ matrix.ghc }}-
- name: Install dependencies