Skip to content

ci(build): Keep precompiled headers when caching with ccache - #3701

Open
CryoTheRenegade wants to merge 1 commit into
TheSuperHackers:mainfrom
CryoTheRenegade:ci/ccache-keep-pch
Open

CryoTheRenegade wants to merge 1 commit into
TheSuperHackers:mainfrom
CryoTheRenegade:ci/ccache-keep-pch

Conversation

@CryoTheRenegade

@CryoTheRenegade CryoTheRenegade commented Nov 19, 2026 •

Copy link
Copy Markdown

@xezon flagged a long CI run on #3697: Build Generals / win32-vcpkg-debug+t+e compiled for 22 minutes. #3608 caused this when it turned precompiled headers off for ccache builds.

#3608 turned precompiled headers off because ccache skipped every source that uses one. Without them, each cache miss compiles all of its headers from scratch. #3697 changed so many headers that 74% of compiles missed.

Turning precompiled headers off also made the debug caches bigger than CCACHE_MAXSIZE=500M. ccache then evicted 150-500 entries per job, so even unchanged main builds only got 62-76% hits.

ccache can cache MSVC and VC6 compiles that use precompiled headers, as long as it is allowed to skip two checks it cannot do inside a precompiled header: #define changes and __DATE__/__TIME__.

 Set Up ccache
+  CCACHE_SLOPPINESS=pch_defines,time_macros
 Configure
   -DCMAKE_C_COMPILER_LAUNCHER=ccache
   -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-  -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON

Side effect: on a cache hit, the __DATE__/__TIME__ that WinMain.cpp builds into CI artifacts can be out of date. Weekly releases do not use ccache.

Evidence

GenCI on the fork branch, compile step of Build Generals / win32-vcpkg-debug+t+e:

Run ccache hits Compile time Cache size
Before, #3697 on upstream 26% 22 min 500 MB, full, 497 evictions
After, empty cache (run) 7% 8.5 min 334 MB, no evictions
After, full cache (run) 100% 71 s 334 MB

On the full-cache run, all 19 jobs that had a saved cache got 100% hits, including all 8 VC6 jobs. Compiles took 20-37 s for VC6 and 38-75 s for MSVC. No job reported an uncacheable compile.

The saved caches are 334-383 MB for MSVC and 43-48 MB for VC6, about 4.2 GB in total. Upstream uses 6.44 GB now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T21:02:34.923724Z ce819e2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The build workflow now configures ccache with pch_defines,time_macros and no longer disables CMake precompiled headers when ccache setup succeeds. It also revises a comment about uncached builds.

Changes

ccache and precompiled headers

Layer / File(s) Summary
Configure ccache with precompiled headers
.github/workflows/reusable-build-toolchain.yml
The ccache setup sets CCACHE_SLOPPINESS to pch_defines,time_macros. The workflow no longer disables CMake precompiled headers after successful ccache setup, and it revises a comment about uncached builds.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

Suggested labels: CI

Suggested reviewers: xezon, tintinhamans

Merge Risk: Minimal · up to ce819

The workflow keeps precompiled headers enabled with ccache, using relaxed sloppiness settings. This speeds up CI builds. Only CI artifacts may carry outdated build date/time strings. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the PR keeps precompiled headers enabled when ccache is used, which matches the workflow change that stops disabling CMake precompiled headers and sets ccache sloppine…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is specific and related to the changeset. It explains that the workflow change re-enables precompiled headers in ccache builds by adding CCACHE_SLOPPINESS=pch_defines,time_macros and r…
Full details: Title check

Explanation

The title names the main change: the PR keeps precompiled headers enabled when ccache is used, which matches the workflow change that stops disabling CMake precompiled headers and sets ccache sloppiness options. It is specific and scoped to CI, with the ci(build) prefix.

Full details: Description check

Explanation

The description is specific and related to the changeset. It explains that the workflow change re-enables precompiled headers in ccache builds by adding CCACHE_SLOPPINESS=pch_defines,time_macros and removing -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON. It also gives the rationale, the side effect on DATE/TIME in CI artifacts, and benchmark evidence from CI runs. The raw summary does not mention the CCACHE_MAXSIZE discussion or the benchmark numbers, but the description is on topic and not generic.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cb62e79f-cf65-4cc9-bfa9-2a65e4607031
Commits

Reviewing files that changed from the base of the PR and between 1f876ba and ce819e2.

Files selected for processing: 1

  • .github/workflows/reusable-build-toolchain.yml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; weekly releases remain outside the changed cache path.

Summary

Keeps precompiled headers enabled in cached Windows builds to reduce work on cache misses.

  • Windows CI builds keep precompiled headers when ccache runs.

CryoTheRenegade explicitly accepts older __DATE__/__TIME__ values in cached CI artifacts. No actionable issues found.

Reviews (1) · Last reviewed commit: "ci(build): Keep precompiled headers when..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant