-
Notifications
You must be signed in to change notification settings - Fork 53
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
Default compiler_check setting does not seem optimal for Github Actions #94
Comments
If you’re using Git then I think you are getting “constant” mtimes because Git keeps track of them. |
We are using Git and |
Interesting. Would you mind creating a minimal reproducing example that we could use as a test for that fix? |
My experiments are Open Source. The branch is here: https://github.com/realm/realm-kotlin/pull/881/files#diff-15c806aa509538190832852f439e9921a23bec2da81f95ed0e4bf13c14e5b160R52. You should be able to clone the repo and just run it, but the full build is currently ~35 minutes. If that isn't working for you I can try to cut it down to something more manageable? |
That would be great! Would be perfect if you could boil it down to using a single file in this repo (or if that doesn’t work, a demo repo) |
According to the docs, this setting influences how the cache matches the compiler binary, but not the source file. So it is about the mtime of the compiler, which should only change if you change the base image for your workflow.
|
I think this is a misunderstanding of ccache. The setting controls how the compiler binary is matched. I had a quick look at your PR, you seem to use the ootb ubuntu compilers. Using I don't know the reason why your didn't see cache hits, the reason must be something else. It would be surprising, I haven't received similar feedback. Note that caches of PR branches are isolated from e.g. the main branch, therefore I am not sure how good caching works in a PR branch, e.g. they might get evicted faster than for main. If you want to follow up on this, I need something smaller and isolated, e.g. a you could create a small project. |
Thank you for the clarification. I'll see if I can reproduce it on a much simpler project. For what it is worth, I got the hint from the React Native docs here: https://reactnative.dev/docs/build-speed#using-this-approach-on-a-ci |
Seems like a mistake on that page. Care to open a bug report there? |
I tried to reproduce it in a simple project here: cmelchior/ccache-action-bug#1 but I cannot reproduce the behavior there and the action seems to work as you describe. So right now my guess is that it is a problem with how the Android NDK build interacts with ccache, but I need to investigate further. You can probably close this issue, I will open a new issue if I discover the root cause. Since React Native also uses the Android NDK, maybe they are seeing the same as I am, so I will wait a little before opening an issue with them as their fix actually seem to work even if it is suboptimal. |
Just hit the same issue on the private project (just pure gh actions, no docker, matrix.os ubuntu.latest). Ccache computes compiler hash by including compiler's mtime/size, for compiler_check=content, it's reading compiler binary instead. This would slow down cache, but if you're not using I think you might provide and option to switch compiler_check to content instead. |
I hit a similar issues seeing 0% direct hits and then changing to content it goes to 100% direct hits. Overhead seems to be negligible as compile times for individual files are long enough that hashing the compiler binary is not an issue. Not sure why mtime does not work for a default Ubuntu 22.04 gcc 12 but as setting it to content fixes it ... (Weirdly I had better hit rates with clang but also not direct but just preprocessed ...). |
@mathiaswagner do you have a link or is this a private repo?
The default gcc in 22.04 is gcc 11. How do you install gcc 12? Do you "apt install" it as part of your build? It is strange that the just installed it,
|
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits, likely because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (see discussion [here](hendrikmuhs/ccache-action#94)). With this change, the NDK itself is cached, which hopefully maintains the `mtime` across builds. PiperOrigin-RevId: 662464572
Currently, `ccache` is not getting any hits because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (it copies the binaries to the `tool-cache`, which sets their `mtime`s to the current time, see discussion [here](hendrikmuhs/ccache-action#94)). PiperOrigin-RevId: 662464572
…d-*` workflow builds. Currently, `ccache` is not getting any hits because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (it copies the binaries to the `tool-cache`, which sets their `mtime`s to the current time, see discussion [here](hendrikmuhs/ccache-action#94)). PiperOrigin-RevId: 662464572
…d-*` workflow builds. Currently, `ccache` is not getting any hits because the `mtime` of the compiler binaries changes every time `sttld/setup-ndk` is called (it copies the binaries to the `tool-cache`, which sets their `mtime`s to the current time, see discussion [here](hendrikmuhs/ccache-action#94)). PiperOrigin-RevId: 662517571
Hi all, I'm seeing the same issue in our builds here. I'm using I have other non-NDK builds in the same workflow that use What I have noticed is that in the logs,
And if I add the following to my workflow:
I can see that the compiler's
This seems to be a result of My current hack to get around this is to
If anybody has a better solution, I'm all ears/eyes! Cheers, Pedro |
This is the default config for ccache:
But using
compiler_check = mtime
is suboptimal for CI as the timestamp changes on every checkout. Shouldn't the default setting becompiler_check = content
?The text was updated successfully, but these errors were encountered: