Thanks for publishing this action! Here a comment on cache keys:
|
- name: Freeze |
|
run: > |
|
cabal freeze |
|
--builddir=${{ env.cabal-build-dir }} |
|
|
|
- name: Cache |
|
uses: actions/cache@v3 |
|
env: |
|
hash: ${{ hashFiles('cabal.project.freeze') }} |
|
with: |
|
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ env.hash }} |
|
restore-keys: | |
|
${{ matrix.os }}-ghc-${{ matrix.ghc }}- |
Since cabal.project.freeze will contain the Hackage repository timestamp, it will be different in almost every single CI run. Thus, it might not be a suitable cache key, being similar to ${{ github.sha }}.
I settled for dist-newstyle/cache/plan.json instead which only contains the package versions, no time stamps. It is generated by cabal build --dry-run.
See e.g. https://github.com/agda/agda/blob/e018e58453a06e4c4a15c9b81396cbcd1e2c640f/src/github/workflows/cabal.yml#L148-L171
There might be reasons why you want the primary key being different in each run, but then it is easier to just use ${{ github.sha }}.
Thanks for publishing this action! Here a comment on cache keys:
haskell-example/.github/workflows/build.yml
Lines 63 to 75 in ed8660f
Since
cabal.project.freezewill contain the Hackage repository timestamp, it will be different in almost every single CI run. Thus, it might not be a suitable cache key, being similar to${{ github.sha }}.I settled for
dist-newstyle/cache/plan.jsoninstead which only contains the package versions, no time stamps. It is generated bycabal build --dry-run.See e.g. https://github.com/agda/agda/blob/e018e58453a06e4c4a15c9b81396cbcd1e2c640f/src/github/workflows/cabal.yml#L148-L171
There might be reasons why you want the primary key being different in each run, but then it is easier to just use
${{ github.sha }}.