Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andreasabel opened this issue Feb 9, 2023 · 0 comments
Open

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

andreasabel opened this issue Feb 9, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@andreasabel
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants