ci: add ccache hit-rate warning when < 75%
What changed, and why it matters
This commit only changes Bitcoin Core's internal continuous integration (CI) scripts. It adds a warning when the build cache (ccache) hit-rate is below 75% and sets a logging variable for macOS CI jobs. There is no change to the Bitcoin software that users run, no wallet or network code is touched, and no security vulnerability is present.
No security action needed. This is a routine CI improvement. Reviewers may optionally verify the ccache parsing is robust, but it does not affect shipped code.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies three CI shell scripts. Two macOS environment setup scripts now export CONTAINER_NAME purely for log annotation context. The main test script prints ccache statistics and, when running under GitHub Actions (CI=true), parses the ccache ‘Hits:’ line and emits a ::notice annotation if the hit-rate is under 75%. This is a build-infrastructure observability change with no effect on compiled binaries or runtime behavior.
Changed components
ci/test/00_setup_env_mac_native.shci/test/00_setup_env_mac_native_fuzz.shci/test/03_test_script.shInspect captured patch +8 / −0
diff --git a/ci/test/00_setup_env_mac_native.sh b/ci/test/00_setup_env_mac_native.sh
index 0cba3751..41a3bc45 100755
--- a/ci/test/00_setup_env_mac_native.sh
+++ b/ci/test/00_setup_env_mac_native.sh
@@ -8,6 +8,7 @@ export LC_ALL=C.UTF-8
# Homebrew's python@3.12 is marked as externally managed (PEP 668).
# Therefore, `--break-system-packages` is needed.
+export CONTAINER_NAME="ci_mac_native" # macos does not use a container, but the env var is needed for logging
export PIP_PACKAGES="--break-system-packages zmq"
export GOAL="install deploy"
export CMAKE_GENERATOR="Ninja"
diff --git a/ci/test/00_setup_env_mac_native_fuzz.sh b/ci/test/00_setup_env_mac_native_fuzz.sh
index d8a61fba..a8010c7a 100755
--- a/ci/test/00_setup_env_mac_native_fuzz.sh
+++ b/ci/test/00_setup_env_mac_native_fuzz.sh
@@ -6,6 +6,7 @@
export LC_ALL=C.UTF-8
+export CONTAINER_NAME="ci_mac_native_fuzz" # macos does not use a container, but the env var is needed for logging
export CMAKE_GENERATOR="Ninja"
export BITCOIN_CONFIG="-DBUILD_FOR_FUZZING=ON -DCMAKE_EXE_LINKER_FLAGS='-Wl,-stack_size -Wl,0x80000'"
export CI_OS_NAME="macos"
diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh
index b3968aaa..a5248b8d 100755
--- a/ci/test/03_test_script.sh
+++ b/ci/test/03_test_script.sh
@@ -145,6 +145,12 @@ cmake --build "${BASE_BUILD_DIR}" "$MAKEJOBS" --target all $GOAL || (
)
bash -c "${PRINT_CCACHE_STATISTICS}"
+if [ "$CI" = "true" ]; then
+ hit_rate=$(ccache -s | grep "Hits:" | head -1 | sed 's/.*(\(.*\)%).*/\1/')
+ if [ "${hit_rate%.*}" -lt 75 ]; then
+ echo "::notice title=low ccache hitrate::Ccache hit-rate in $CONTAINER_NAME was $hit_rate%"
+ fi
+fi
du -sh "${DEPENDS_DIR}"/*/
du -sh "${PREVIOUS_RELEASES_DIR}"
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.