Skip to content

Commit e4493b1

Browse files
committed
ci: add ccache hit-rate warning when < 75%
Github-Pull: bitcoin#32989 Rebased-From: dd1c590 Print the ccache hit-rate for the job using a GitHub annotation if it was below 75%.
1 parent a0b6e2a commit e4493b1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-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
@@ -9,6 +9,7 @@ export LC_ALL=C.UTF-8
99
export HOST=x86_64-apple-darwin
1010
# Homebrew's python@3.12 is marked as externally managed (PEP 668).
1111
# Therefore, `--break-system-packages` is needed.
12+
export CONTAINER_NAME="ci_mac_native" # macos does not use a container, but the env var is needed for logging
1213
export PIP_PACKAGES="--break-system-packages zmq"
1314
export GOAL="install"
1415
export BITCOIN_CONFIG="--with-gui --with-miniupnpc --with-natpmp --enable-reduce-exports"

ci/test/03_test_script.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ fi
145145
bash -c "${MAYBE_BEAR} ${MAYBE_TOKEN} make $MAKEJOBS $GOAL" || ( echo "Build failure. Verbose build follows." && make "$GOAL" V=1 ; false )
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)