-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
CI add ccache for GitHub Actions #31895
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
Conversation
Three comments for reviewers:
|
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.
Pretty cool!
.github/workflows/unit-tests.yml
Outdated
uses: actions/cache@v4 | ||
with: | ||
path: ${{ github.workspace }}/ccache | ||
key: ccache-${{ runner.os }}-${{ steps.get-compiler.outputs.compiler }} |
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.
do we want to make sure this is only within each PR, and not shared between PRs, to make sure there's no cache poisoning happening?
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.
@lesteve and I had talked about this. If I understood correctly then it would be preferable to allow sharing the ccache across several PRs, because ccache is smart enough to compare the contents of the source c and cpp files before reusing their build. I also think it would quickly clutter if we had a cache for each PR.
Or do you refer to security questions?
Another thought that came to my mind:
Does it make sense to have an action/repository setting/makefile command (not sure how it should look like) (here is an actions workflow that would do that) that deletes the ccache to clean out old min dependency builds that are not used anymore or when we need a fresh start. That could be regular or on demand.
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.
My understanding is that GHA cache already has some builtin protections, see doc.
can we test this by having another commit and see if cache works? |
Nice, it seems to work fine. There may be some tweaks that we can do which I will suggest soon:
|
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.
LGTM. I'll let @lesteve decide if improvements need to be done here or other PRs.
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Here is the thinking behind the cache key:
|
Let's merge this one and adapt if we notice possible improvements to the cache key strategy. |
Reference Issues/PRs
Follow up on #31832
What does this implement/fix? Explain your changes.
This PR adds a step to use a cache for ccache on the GitHub Actions job(s) in the
unit-tests.yml
.Thanks for your support @lesteve and @adrinjalali! 🫶
Comments
From my experiments on another branch it seems that this speeds up the build of scikit-learn by 1 min (1 min instead of 2 mins) on ARM.
This won't work on windows.