Skip to content

cabal freeze file is not so suitable as cache key #22

@andreasabel

Description

@andreasabel

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 }}.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions