Skip to content

ci: add ccache/sccache compilation caching to speed up CI builds#360

Open
Cuiyus wants to merge 7 commits intoalibaba:mainfrom
Cuiyus:ci/ccache-sccache-optimization
Open

ci: add ccache/sccache compilation caching to speed up CI builds#360
Cuiyus wants to merge 7 commits intoalibaba:mainfrom
Cuiyus:ci/ccache-sccache-optimization

Conversation

@Cuiyus
Copy link
Copy Markdown
Collaborator

@Cuiyus Cuiyus commented Apr 20, 2026

  • add ccachecompilation caching to speed up CI builds (Windows is unable to enable cache acceleration because sccache cannot recognize /FS)
  • switch MacOS & Linux build from Unix Makefiles to Ninja generator

- Use hendrikmuhs/ccache-action@v1.2 for Linux/macOS/iOS/Android/clang-tidy
  (auto-installs ccache, manages cache, sets env vars, shows stats)
- Use mozilla-actions/sccache-action@v0.0.9 for Windows (MSVC compatible)
- Add CMAKE_C/CXX_COMPILER_LAUNCHER to all CMake build steps
- Exclude wheel build and nightly coverage workflows per decision
Cuiyus added 5 commits April 21, 2026 15:45
- Replace CMAKE_GENERATOR='Unix Makefiles' with 'Ninja' in pip build
- Replace 'make unittest -j' with 'cmake --build --target unittest --parallel'
- Add '-G Ninja' to C++ and C example cmake configure steps
- Replace 'make -j' with 'cmake --build --parallel' for examples
- Aligns with Windows and Android workflows which already use Ninja
- Use CMake ProcessorCount module to detect available CPU cores
- Add -j ${NPROC} to ctest command for parallel test execution
- Add --timeout 300 to prevent individual tests from hanging CI
- Fallback to NPROC=1 when ProcessorCount returns 0
- iOS target unchanged (build-only, no test execution)
Windows (05-windows-build.yml):
- Remove mozilla-actions/sccache-action: sccache incompatible with MSVC /FS flag
- Remove SCCACHE_GHA_ENABLED env var
- Remove CMAKE_C/CXX_COMPILER_LAUNCHER=sccache from build steps
- Remove 'Show sccache statistics' step
- MSVC /FS (global PDB concurrency flag) causes fatal C1041 when used with sccache

MacOS & Linux (03-macos-linux-build.yml):
- Fix cmake.define values: remove extra quotes around 'ccache' and 'ON'
- Bare values required: cmake.define.FOO=bar not cmake.define.FOO="bar"
@Cuiyus Cuiyus requested a review from feihongxu0824 April 21, 2026 08:00
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