Skip to content

Commit cf44adf

Browse files
committed
Merge bitcoin/bitcoin#30310: ci: add option for running tests without volume
da205dd ci: increase available ccache size to 300MB (Max Edwards) 4ecbbd9 ci: add option for running tests without volume (Max Edwards) Pull request description: Fixes: bitcoin/bitcoin#30193 (comment) Cache wasn't being saved when run on GHA because the default behaviour of the CI script was to store cache items in a docker volume. This works on Cirrus CI as the volumes are shared but it does not work on Github Actions in which each run is ephemeral. Kept the default behaviour the same so hopefully this continues to work for the Cirrus CI jobs. ACKs for top commit: maflcko: utACK da205dd hebasto: ACK da205dd. Tree-SHA512: 3b35482c0628adb60574a1462181ecfcb06cb237ed48beb6fe9aa51110be82f863dc9147e7f8d82960450aa6ecc3a24a70e3c8283fd24cdad075dbfb8fc93095
2 parents 5383637 + da205dd commit cf44adf

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,17 @@ jobs:
313313
timeout-minutes: 120
314314
env:
315315
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
316+
DANGER_CI_ON_HOST_CACHE_FOLDERS: 1
316317
steps:
317318
- name: Checkout
318319
uses: actions/checkout@v4
319320

320321
- name: Set Ccache directory
321322
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
322323

324+
- name: Set base root directory
325+
run: echo "BASE_ROOT_DIR=${RUNNER_TEMP}" >> "$GITHUB_ENV"
326+
323327
- name: Restore Ccache cache
324328
id: ccache-cache
325329
uses: actions/cache/restore@v4

ci/test/00_setup_env_native_asan.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ export BITCOIN_CONFIG="--enable-usdt --enable-zmq --with-incompatible-bdb --with
2626
CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' \
2727
--with-sanitizers=address,float-divide-by-zero,integer,undefined \
2828
CC='clang-18 -ftrivial-auto-var-init=pattern' CXX='clang++-18 -ftrivial-auto-var-init=pattern'"
29+
export CCACHE_MAXSIZE=300M

ci/test/02_run_container.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
3030
docker volume create "${CONTAINER_NAME}_depends_sources" || true
3131
docker volume create "${CONTAINER_NAME}_previous_releases" || true
3232

33+
CI_CCACHE_MOUNT="type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR"
34+
CI_DEPENDS_MOUNT="type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR/built"
35+
CI_DEPENDS_SOURCES_MOUNT="type=volume,src=${CONTAINER_NAME}_depends_sources,dst=$DEPENDS_DIR/sources"
36+
CI_PREVIOUS_RELEASES_MOUNT="type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR"
37+
38+
if [ "$DANGER_CI_ON_HOST_CACHE_FOLDERS" ]; then
39+
# ensure the directories exist
40+
mkdir -p "${CCACHE_DIR}"
41+
mkdir -p "${DEPENDS_DIR}/built"
42+
mkdir -p "${DEPENDS_DIR}/sources"
43+
mkdir -p "${PREVIOUS_RELEASES_DIR}"
44+
45+
CI_CCACHE_MOUNT="type=bind,src=${CCACHE_DIR},dst=$CCACHE_DIR"
46+
CI_DEPENDS_MOUNT="type=bind,src=${DEPENDS_DIR}/built,dst=$DEPENDS_DIR/built"
47+
CI_DEPENDS_SOURCES_MOUNT="type=bind,src=${DEPENDS_DIR}/sources,dst=$DEPENDS_DIR/sources"
48+
CI_PREVIOUS_RELEASES_MOUNT="type=bind,src=${PREVIOUS_RELEASES_DIR},dst=$PREVIOUS_RELEASES_DIR"
49+
fi
50+
3351
docker network create --ipv6 --subnet 1111:1111::/112 ci-ip6net || true
3452

3553
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
@@ -52,10 +70,10 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
5270
# shellcheck disable=SC2086
5371
CI_CONTAINER_ID=$(docker run --cap-add LINUX_IMMUTABLE $CI_CONTAINER_CAP --rm --interactive --detach --tty \
5472
--mount "type=bind,src=$BASE_READ_ONLY_DIR,dst=$BASE_READ_ONLY_DIR,readonly" \
55-
--mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \
56-
--mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR/built" \
57-
--mount "type=volume,src=${CONTAINER_NAME}_depends_sources,dst=$DEPENDS_DIR/sources" \
58-
--mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \
73+
--mount "${CI_CCACHE_MOUNT}" \
74+
--mount "${CI_DEPENDS_MOUNT}" \
75+
--mount "${CI_DEPENDS_SOURCES_MOUNT}" \
76+
--mount "${CI_PREVIOUS_RELEASES_MOUNT}" \
5977
--env-file /tmp/env-$USER-$CONTAINER_NAME \
6078
--name "$CONTAINER_NAME" \
6179
--network ci-ip6net \

0 commit comments

Comments
 (0)