Compare commits

...

4 Commits

Author SHA1 Message Date
Hanif Koh
6b1f1863d5 ci: warm-cache run without precompiled headers 2026-09-09 22:36:54 +08:00
Hanif Koh
4fabfb9237 ci: build without precompiled headers when the compiler cache is on
Clang rebuilds the precompiled header with a fresh timestamp on every
run, so every file that includes it misses the cache: the warm run hit
178 of 927 compiles on Linux. Forward ORCA_EXTRA_BUILD_ARGS from the
macOS and Windows build scripts the way build_linux.sh already does, and
pass SLIC3R_PCH=OFF through it whenever ccache is enabled.
2026-09-09 20:37:58 +08:00
Hanif Koh
77f60efba8 ci: warm-cache run 2026-09-09 19:39:25 +08:00
Hanif Koh
86f73c889b ci: cache compiled objects between runs
Every CI leg compiles the whole tree from scratch, 45 to 57 minutes of
each build job. Add ccache to the slicer build on all platforms, keyed per
leg, restored at the start and saved at the end of the job.

Pull requests are meant to restore only; saving is enabled here so a
second run on this branch measures a warm cache.
2026-09-09 17:42:56 +08:00
3 changed files with 41 additions and 3 deletions

View File

@@ -76,6 +76,37 @@ jobs:
if (-not (Test-Path "$cmakeBin\cmake.exe")) { throw "cmake.exe not found at $cmakeBin" }
Add-Content -Path $env:GITHUB_PATH -Value $cmakeBin
# Compiler cache. Objects are keyed on the preprocessed source, the
# compiler binary and the flags, so a leg only ever hits its own entries.
# Pushes save (main keeps the cache warm); pull requests restore it and
# discard what they compiled, so the store does not grow per PR. A failed
# install only costs the caching, not the build.
- name: Compiler cache
id: ccache
if: ${{ !inputs.macos-combine-only }}
continue-on-error: true
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-${{ inputs.arch || 'amd64' }}${{ runner.os == 'Windows' && format('-{0}', inputs.compiler) || '' }}
max-size: 2G
# TEST: pull requests save too, so a second run on this branch measures
# a warm cache. Restore-only for pull_request before merge.
save: true
- name: Enable compiler cache
if: ${{ steps.ccache.outcome == 'success' }}
shell: bash
run: |
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> "$GITHUB_ENV"
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> "$GITHUB_ENV"
# Needed for precompiled headers and for headers a fresh checkout
# has just written.
echo "CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime,include_file_ctime" >> "$GITHUB_ENV"
# Clang rebuilds the precompiled header with a fresh timestamp on
# every run, so every file that includes it misses the cache. All
# three build scripts forward this to the slicer configure.
echo "ORCA_EXTRA_BUILD_ARGS=-DSLIC3R_PCH=OFF" >> "$GITHUB_ENV"
- name: Get the version and date on Ubuntu and macOS
if: runner.os != 'Windows'
run: |
@@ -670,3 +701,8 @@ jobs:
asset_name: orca_custom_preset_tests.zip
asset_content_type: application/octet-stream
max_releases: 1
- name: Compiler cache statistics
if: ${{ always() && steps.ccache.outcome == 'success' }}
shell: bash
run: ccache -s -v || ccache -s

View File

@@ -255,6 +255,7 @@ function build_slicer() {
mkdir -p "$PROJECT_BUILD_DIR"
cd "$PROJECT_BUILD_DIR"
if [ "1." != "$BUILD_ONLY". ]; then
read -r -a EXTRA_BUILD_ARGS <<< "${ORCA_EXTRA_BUILD_ARGS:-}"
cmake "${PROJECT_DIR}" \
-G "${SLICER_CMAKE_GENERATOR}" \
-DORCA_TOOLS=ON \
@@ -264,7 +265,8 @@ function build_slicer() {
-DCMAKE_OSX_ARCHITECTURES="${_ARCH}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
-DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \
${CMAKE_POLICY_COMPAT}
${CMAKE_POLICY_COMPAT} \
"${EXTRA_BUILD_ARGS[@]}"
fi
cmake --build . --config "$BUILD_CONFIG" --target "$SLICER_BUILD_TARGET"
)

View File

@@ -164,10 +164,10 @@ cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake .. -G %CMAKE_GENERATOR% %CLANG_ARG% -DORCA_TOOLS=ON %SIG_FLAG% -DBUILD_TESTS=%BUILD_TESTS% -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G %CMAKE_GENERATOR% %CLANG_ARG% -DORCA_TOOLS=ON %SIG_FLAG% -DBUILD_TESTS=%BUILD_TESTS% -DCMAKE_BUILD_TYPE=%build_type% %ORCA_EXTRA_BUILD_ARGS%
cmake --build . --config %build_type% --target all
) else (
cmake .. -G %CMAKE_GENERATOR% -A %arch% %TOOLSET_ARG% -DORCA_TOOLS=ON %SIG_FLAG% -DBUILD_TESTS=%BUILD_TESTS% -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G %CMAKE_GENERATOR% -A %arch% %TOOLSET_ARG% -DORCA_TOOLS=ON %SIG_FLAG% -DBUILD_TESTS=%BUILD_TESTS% -DCMAKE_BUILD_TYPE=%build_type% %ORCA_EXTRA_BUILD_ARGS%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
)
@echo off