-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fixing Github actions caching (issue #529) #530
Conversation
If we look at the first run of this PR we see, under "ubuntu-latest / ghc-8.4.4"
but then when I rerun it, also under "ubuntu-latest / ghc-8.4.4) we see
I don't understand why it's trying to use a different key. I guess the order of update, configure, freeze needs to be corrected, but I'm not sure how. |
Hmm that's weird... I'll check in my fork what are the differences in the |
@tomjaguarpaw I think I've found the issue. The hash of the
Here are the whole files if you want to run a diff between them: Details
Details
I think this could only be solved if we copy the file, removing the last line, and use the hash of that for the cache key. Tell me if I should try that. |
Interesting! But doesn't the |
I'm afraid that it seems not to be the case. Here's the freeze file without running https://github.com/0rphee/stan/actions/runs/6565222577/job/17833263692#step:5:144 It keeps that last line. |
Yes, sorry, I wasn't clear. I meant doesn't the most recent |
I'm inclined to think that in fact, when running cabal freeze, the hackage index is updated. As the machines do not keep state, they should need to check the index at least once: when running cabal freeze. That would be the reason why that timestamp changes every CI run. The cause for the few cache hits would be that maybe the hackage server "saves" the index, every few minutes, and consecutive runs might be in that window, depending on the speed of the runner. Here's the timestamp of a more recent run without cabal update. It changes respective to the last one: https://github.com/0rphee/stan/actions/runs/6565928553/job/17835539008#step:5:146 |
When I run |
I checked a bunch of repos and found this:
So, I see two alternatives:
|
OK, let's try calculating the hash from a file with the timestamp removed! |
7535bd4
to
db99b0e
Compare
@tomjaguarpaw I think this has done the trick! However, I suppose that if/when, dependencies are added, the whole cache will get thrown away, but I suppose that due to the state of the project, that won't happen very often, if at all lol. Just another two things: 1) Perhaps your comment will no longer be valid? and 2) while checking the other repos, I saw that some of them also cached |
otherwise we can't find a build plan
@tomjaguarpaw It now seems to work just fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
haskell/actions/setup is now deprecated
That's great, thanks @0rphee and @andreasabel! The "Setup Haskell" stage takes a long time so I wonder if we can cache that too: #536 |
Hmm, but now the run for https://github.com/kowainik/stan/actions/runs/6603780564/job/17937257826 No idea why not. Let's keep our eyes on this and see what happens. |
Oh, I think that's because the caches are per-branch. So this is probably fine. |
This seems to explain the policy: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache A PR branched off So I think we are good! |
Solves #529