Skip to content

Commit dd1c590

Browse files
committed
ci: add ccache hit-rate warning when < 75%
Print the ccache hit-rate for the job using a GitHub annotation if it was below 75%.
1 parent f427284 commit dd1c590

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

ci/test/00_setup_env_mac_native.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export LC_ALL=C.UTF-8
88

99
# Homebrew's [email protected] is marked as externally managed (PEP 668).
1010
# Therefore, `--break-system-packages` is needed.
11+
export CONTAINER_NAME="ci_mac_native" # macos does not use a container, but the env var is needed for logging
1112
export PIP_PACKAGES="--break-system-packages zmq"
1213
export GOAL="install deploy"
1314
export CMAKE_GENERATOR="Ninja"

ci/test/00_setup_env_mac_native_fuzz.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
export LC_ALL=C.UTF-8
88

9+
export CONTAINER_NAME="ci_mac_native_fuzz" # macos does not use a container, but the env var is needed for logging
910
export CMAKE_GENERATOR="Ninja"
1011
export BITCOIN_CONFIG="-DBUILD_FOR_FUZZING=ON -DCMAKE_EXE_LINKER_FLAGS='-Wl,-stack_size -Wl,0x80000'"
1112
export CI_OS_NAME="macos"

ci/test/03_test_script.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ cmake --build "${BASE_BUILD_DIR}" "$MAKEJOBS" --target all $GOAL || (
145145
)
146146

147147
bash -c "${PRINT_CCACHE_STATISTICS}"
148+
if [ "$CI" = "true" ]; then
149+
hit_rate=$(ccache -s | grep "Hits:" | head -1 | sed 's/.*(\(.*\)%).*/\1/')
150+
if [ "${hit_rate%.*}" -lt 75 ]; then
151+
echo "::notice title=low ccache hitrate::Ccache hit-rate in $CONTAINER_NAME was $hit_rate%"
152+
fi
153+
fi
148154
du -sh "${DEPENDS_DIR}"/*/
149155
du -sh "${PREVIOUS_RELEASES_DIR}"
150156

0 commit comments

Comments
 (0)