ci: Only save caches on main and release branches

This restores caches on all branches and pull requests, but only stores
them on the main branch and release branches. This prevents those caches
from being evicted early when we hit the 10 GB limit quickly.
This commit is contained in:
Wolfgang Walther
2024-05-20 15:43:00 +02:00
committed by Wolfgang Walther
parent 7e61c9deb0
commit c4b0bd347b
2 changed files with 37 additions and 8 deletions
+6 -8
View File
@@ -115,12 +115,11 @@ jobs:
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Stack working files cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: ./.github/actions/cache-on-main
with:
path: ${{ matrix.cache }}
key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
restore-keys: |
stack-${{ runner.os }}-
prefix: stack
suffix: ${{ hashFiles('stack.yaml.lock') }}
- name: Install dependencies
if: matrix.deps
run: ${{ matrix.deps }}
@@ -171,15 +170,14 @@ jobs:
run: |
mkdir ~/.cabal
- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: ./.github/actions/cache-on-main
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }}
restore-keys: |
cabal-${{ runner.os }}-${{ matrix.ghc }}-
prefix: cabal-${{ matrix.ghc }}
suffix: ${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }}
- name: Install dependencies
run: |
cabal update