hendrikmuhs / ccache-action

github action to speedup building using ccache
MIT License
118 stars 53 forks source link

Any idea why ccache not working for this `publish-docker` workflow (but it does for this other `unixlike-builds CI` workflow)? #108

Open rturrado opened 2 years ago

rturrado commented 2 years ago

Hi!

I believe I'm following exactly the same steps in these two workflows: https://github.com/rturrado/the_modern_cpp_challenge/tree/unixlike-builds/.github/workflows

However, ccache works in one of the workflows: https://github.com/rturrado/the_modern_cpp_challenge/actions/runs/3264947175/jobs/5366385462 (see step ccache / Restore cache).

But not in the other: https://github.com/rturrado/the_modern_cpp_challenge/actions/runs/3264957407/jobs/5366408088

Thanks!

jonashaag commented 2 years ago

What exactly does it mean to "not work" in this case? The second seems to save the cache so that looks like it's "working".

rturrado commented 2 years ago

If you see the step ccache / Restore cache, it always says No cache found.. Even if, as you correctly say, it was saved before (and I'm not changing any source file, just yaml files, READMEs, and so on).

rturrado commented 2 years ago

I think this "issue" may be related, if not the same, to this other: https://github.com/docker/build-push-action/issues/433

They say there that pushing to a new tag doesn't use the existing cache. Whereas deleting the previous tag, and pushing again to the previous tag uses the existing cache.

jonashaag commented 2 years ago

Can you please link to two subsequent GHA runs that show this behaviour? So far we‘ve only seen a single one that populates the cache.

rturrado commented 2 years ago

Definitely:

jonashaag commented 2 years ago

The commits were made on two different branches. They do not share caches by GHA design. Did you expect a cache from master/main to be used in one of the builds?

rturrado commented 2 years ago

All the work I'm doing lately is on the unixlike-builds branch. I first do a git push, what triggers the unixlike-builds CI workflow, and then a git tag TAG && git push origin TAG, which triggers the publish docker workflow. The two links above correspond to successive runs of the publish docker workflow.

jonashaag commented 2 years ago

Hm you're right, something is not working here. Is your repository reaching the cache size limit?

rturrado commented 2 years ago

I don't believe so. Cache is being saved successfully. It's taking 51MB out of a 500MB max size. Have a look at the first link again:

Run hendrikmuhs/ccache-action@v1.[2](https://github.com/rturrado/the_modern_cpp_challenge/actions/runs/3260925998/jobs/5354957848#step:8:2)
  with:
    key: publish-docker
    max-size: 500M
Cache Size: ~51 MB (53124898 B)
Cache saved successfully
jonashaag commented 2 years ago

I was wondering about repository level cache limit, but honestly that's just a last straw, I really have no ideas left :(

rturrado commented 2 years ago

@jonashaag many thanks for you attention anyway!