Skip to content

feat(ci): Add ccache support for faster builds#882

Merged
yangxk1 merged 12 commits intoapache:mainfrom
SYaoJun:227_ccache
Feb 28, 2026
Merged

feat(ci): Add ccache support for faster builds#882
yangxk1 merged 12 commits intoapache:mainfrom
SYaoJun:227_ccache

Conversation

@SYaoJun
Copy link
Contributor

@SYaoJun SYaoJun commented Feb 27, 2026

fix: #879

Signed-off-by: syaojun <libevent@yeah.net>
@SYaoJun SYaoJun changed the title feat(ci): Add configurable ccache support with CI caching feat(ci): Add ccache support for faster builds Feb 27, 2026
Signed-off-by: syaojun <libevent@yeah.net>
@SYaoJun
Copy link
Contributor Author

SYaoJun commented Feb 27, 2026

still very time-consuming

@SYaoJun SYaoJun marked this pull request as draft February 27, 2026 01:28
@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.77%. Comparing base (0042a6c) to head (ee3367e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #882      +/-   ##
============================================
- Coverage     79.84%   76.77%   -3.07%     
  Complexity      615      615              
============================================
  Files            93       84       -9     
  Lines         10310     8897    -1413     
  Branches       1055     1055              
============================================
- Hits           8232     6831    -1401     
+ Misses         1838     1826      -12     
  Partials        240      240              
Flag Coverage Δ
cpp 70.79% <ø> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SYaoJun

This comment was marked as outdated.

@SYaoJun SYaoJun marked this pull request as ready for review February 27, 2026 04:04
Signed-off-by: syaojun <libevent@yeah.net>
with:
path: ~/.ccache
key: ${{ matrix.os }}-build-ccache-${{ hashFiles('**/git-modules.txt') }}
key: ${{ runner.os }}-nightly-ccache-${{ github.sha }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it be changed to runner?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matrix.os variable is not configured in the CI pipeline. If the pipeline needs to utilize matrix.os, this variable must first be explicitly defined in the configuration as follows:

strategy:
  matrix:
    os: [ubuntu-latest, macos-latest]

Therefore, the runner.os variable should be used instead in the current setup.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds ccache support to speed up C++ compilation in CI workflows, particularly targeting the slow macOS C++ CI pipeline that was taking over 1.5 hours. The implementation adds a configurable ccache option to CMakeLists.txt and integrates ccache caching into GitHub Actions workflows for Ubuntu, macOS, and nightly builds.

Changes:

  • Added GRAPHAR_ENABLE_CCACHE CMake option (defaulting to ON) with graceful fallback when ccache is not available
  • Integrated ccache caching in GitHub Actions workflows for Ubuntu and macOS CI jobs
  • Updated nightly CI workflow to use actions/cache@v4 with improved cache configuration
  • Restructured benchmark linking logic for macOS to be more maintainable
  • Added linker optimizations and SystemConfiguration framework for macOS benchmarks

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
cpp/CMakeLists.txt Added GRAPHAR_ENABLE_CCACHE option with detection logic; restructured macOS benchmark linking; added linker optimizations for faster macOS linking
.github/workflows/ci.yml Added ccache caching steps for both Ubuntu and macOS CI jobs
.github/workflows/ci-nightly.yml Updated to use actions/cache@v4 and improved cache key naming

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
@SYaoJun
Copy link
Contributor Author

SYaoJun commented Feb 27, 2026

For Simplicity, this PR mainly resolved ccahe configuration in CI.
Linux and MacOS have different cache path.
I created another PR #885 to address the problem for build time.

@SYaoJun SYaoJun requested a review from yangxk1 February 27, 2026 16:33
Copy link
Contributor

@yangxk1 yangxk1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yangxk1 yangxk1 merged commit c2e44a8 into apache:main Feb 28, 2026
5 checks passed
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.

[CI] the macOS C++ CI pipeline is time-consuming and requires optimization.

4 participants