-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Speed up CI builds with ccache (seeded from develop) #16356
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
f738513
51177ce
4df4fd0
456a48c
321465f
25d5d8b
b50f7d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -208,9 +208,44 @@ commands: | |||||||||||
|
|
||||||||||||
| run_build: | ||||||||||||
| steps: | ||||||||||||
| # TODO: remove the line below | ||||||||||||
| # Before merging this PR we need to use an alternative develop branch to test the functionality, `develop-cache-test` | ||||||||||||
|
|
||||||||||||
| # On `develop-cache-test` we intentionally do NOT restore any ccache, so every run starts from scratch. | ||||||||||||
| # Other branches restore the most recent cache produced on `develop-cache-test`. | ||||||||||||
| - when: | ||||||||||||
| condition: | ||||||||||||
| not: | ||||||||||||
| equal: ["develop-cache-test", << pipeline.git.branch >>] | ||||||||||||
|
||||||||||||
| steps: | ||||||||||||
| - restore_cache: | ||||||||||||
| keys: | ||||||||||||
| # Reuse cache produced on develop-cache-test (prefix match; restores the most recent). | ||||||||||||
| - v1-ccache-{{ arch }}-develop-cache-test- | ||||||||||||
| - v1-ccache-{{ arch }}- | ||||||||||||
marcocastignoli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
| - run: | ||||||||||||
|
||||||||||||
| - v1-ccache-{{ arch }}- | |
| - run: | |
| - v1-ccache-{{ arch }}- | |
| # WARNING! If you edit anything between here and save_cache, remember to bump version or invalidate the cache manually. | |
| - run: |
Outdated
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 expect not to have this on any of the platforms?
Is that platform Windows? :P
Outdated
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.
I expect that we might want to invalidate cache whenever we suspect something weird is going on. It would be convenient to be able to do that without having to merge a PR. In an extreme case we might even not be able to merge one due to required jobs failing because of cache. In addition to the hard-coded version we could also keep a variable in CircleCI config that we can bump to get the same effect:
| key: v1-ccache-{{ arch }}-develop-cache-test-{{ .Revision }} | |
| key: v1-{{ .Environment.CCACHE_KEY }}-ccache-{{ arch }}-develop-cache-test-{{ .Revision }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ RUN apt-get update; \ | |
| automake \ | ||
| bison \ | ||
| build-essential \ | ||
| ccache \ | ||
| curl \ | ||
| git \ | ||
| jq \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ RUN set -ex; \ | |
| apt-get install -qqy --no-install-recommends \ | ||
| build-essential \ | ||
| cmake \ | ||
| ccache \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a special workflow for updating buildpack images and this needs to be done in two steps (separate PRs). See |
||
| jq \ | ||
| libboost-filesystem-dev \ | ||
| libboost-program-options-dev \ | ||
|
|
||
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.
We want to be able to run without ccache on tags, so we still need to keep a non-cached variant of this command around.
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.
What do you think is the best solution to handle this case? Something like this would work or do we need a more generic solution?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, that should work.
I mean, I would have preferred something that directly passes this decision as a parameter from the top, but I that would be annoying, because you'd have to modify most jobs to have parameters. A global version like this does not have this problem.