Skip to content

Commit d97ddbe

Browse files
committed
Merge bitcoin/bitcoin#30193: ci: move ASan job to GitHub Actions from Cirrus CI
9eea51d ci: move Asan / LSan / USDT job to Github Actions (Max Edwards) 4b527fa ci: add IPV6 network to ci container (Max Edwards) Pull request description: PR for moving the ASAN + LSAN + USDT + friends job to github actions from Cirrus. The motivation for this PR is that this task needs a full VM (or bare metal) to function, because of the tracepoints. It can not run in a container on an arbitrary Linux, because the outside machine must exactly match the specification of the distro used in the CI task config. This requires more maintenance for the persistent worker, and I think moving to GHA will reduce the maintenance burden, or at least make it possible for anyone to work on. Also, it makes it easier to run the task on forks (bitcoin-inquisition, bitcoin-knots, devel forks, ...) without having to set-up a real machine. ACKs for top commit: maflcko: review ACK 9eea51d achow101: ACK 9eea51d hebasto: ACK 9eea51d. Tree-SHA512: 1111c1c9e3a11e725dff1344643fff3c91fb9b4d7c1cc9a7d507a8f146f5223316a00272030b41ae37ecb59d044f2e90e1cd907450049b25f094f0b60643d4c7
2 parents f011022 + 9eea51d commit d97ddbe

File tree

4 files changed

+50
-17
lines changed

4 files changed

+50
-17
lines changed

.cirrus.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ env: # Global defaults
4343
# The following specific types should exist, with the following requirements:
4444
# - small: For an x86_64 machine, recommended to have 2 CPUs and 8 GB of memory.
4545
# - medium: For an x86_64 machine, recommended to have 4 CPUs and 16 GB of memory.
46-
# - noble: For a machine running the Linux kernel shipped with exaclty Ubuntu Noble 24.04. The machine is recommended to have 4 CPUs and 16 GB of memory.
4746
# - arm64: For an aarch64 machine, recommended to have 2 CPUs and 8 GB of memory.
4847

4948
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
@@ -159,19 +158,6 @@ task:
159158
env:
160159
FILE_ENV: "./ci/test/00_setup_env_native_msan.sh"
161160

162-
task:
163-
name: 'ASan + LSan + UBSan + integer, no depends, USDT'
164-
enable_bpfcc_script:
165-
# In the image build step, no external environment variables are available,
166-
# so any settings will need to be written to the settings env file:
167-
- sed -i "s|\${CIRRUS_CI}|true|g" ./ci/test/00_setup_env_native_asan.sh
168-
<< : *GLOBAL_TASK_TEMPLATE
169-
persistent_worker:
170-
labels:
171-
type: noble # Must use this specific worker (needed for USDT functional tests)
172-
env:
173-
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
174-
175161
task:
176162
name: 'fuzzer,address,undefined,integer, no depends'
177163
<< : *GLOBAL_TASK_TEMPLATE

.github/workflows/ci.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
env:
21-
DANGER_RUN_CI_ON_HOST: 1
2221
CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error
2322
MAKEJOBS: '-j10'
2423

@@ -81,6 +80,7 @@ jobs:
8180
timeout-minutes: 120
8281

8382
env:
83+
DANGER_RUN_CI_ON_HOST: 1
8484
FILE_ENV: './ci/test/00_setup_env_mac_native.sh'
8585
BASE_ROOT_DIR: ${{ github.workspace }}
8686

@@ -304,3 +304,43 @@ jobs:
304304
BITCOINFUZZ: "${{ github.workspace}}\\src\\fuzz.exe"
305305
shell: cmd
306306
run: py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_seed_corpus
307+
308+
asan-lsan-ubsan-integer-no-depends-usdt:
309+
name: 'ASan + LSan + UBSan + integer, no depends, USDT'
310+
runs-on: ubuntu-24.04 # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools
311+
# No need to run on the read-only mirror, unless it is a PR.
312+
if: github.repository != 'bitcoin-core/gui' || github.event_name == 'pull_request'
313+
timeout-minutes: 120
314+
env:
315+
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
316+
INSTALL_BCC_TRACING_TOOLS: true
317+
steps:
318+
- name: Checkout
319+
uses: actions/checkout@v4
320+
321+
- name: Set Ccache directory
322+
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
323+
324+
- name: Restore Ccache cache
325+
id: ccache-cache
326+
uses: actions/cache/restore@v4
327+
with:
328+
path: ${{ env.CCACHE_DIR }}
329+
key: ${{ github.job }}-ccache-${{ github.run_id }}
330+
restore-keys: ${{ github.job }}-ccache-
331+
332+
- name: Enable bpfcc script
333+
# In the image build step, no external environment variables are available,
334+
# so any settings will need to be written to the settings env file:
335+
run: sed -i "s|\${INSTALL_BCC_TRACING_TOOLS}|true|g" ./ci/test/00_setup_env_native_asan.sh
336+
337+
- name: CI script
338+
run: ./ci/test_run_all.sh
339+
340+
- name: Save Ccache cache
341+
uses: actions/cache/save@v4
342+
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
343+
with:
344+
path: ${{ env.CCACHE_DIR }}
345+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
346+
key: ${{ github.job }}-ccache-${{ github.run_id }}

ci/test/00_setup_env_native_asan.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
export LC_ALL=C.UTF-8
88

99
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
10-
# Only install BCC tracing packages in Cirrus CI.
11-
if [[ "${CIRRUS_CI}" == "true" ]]; then
10+
11+
# Only install BCC tracing packages in CI. Container has to match the host for BCC to work.
12+
if [[ "${INSTALL_BCC_TRACING_TOOLS}" == "true" ]]; then
13+
# Required for USDT functional tests to run
1214
BPFCC_PACKAGE="bpfcc-tools linux-headers-$(uname --kernel-release)"
1315
export CI_CONTAINER_CAP="--privileged -v /sys/kernel:/sys/kernel:rw"
1416
else

ci/test/02_run_container.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
1616
# System-dependent env vars must be kept as is. So read them from the container.
1717
docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append "/tmp/env-$USER-$CONTAINER_NAME"
1818
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
19+
1920
DOCKER_BUILDKIT=1 docker build \
2021
--file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \
2122
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
2223
--build-arg "FILE_ENV=${FILE_ENV}" \
2324
--label="${CI_IMAGE_LABEL}" \
2425
--tag="${CONTAINER_NAME}" \
2526
"${BASE_READ_ONLY_DIR}"
27+
2628
docker volume create "${CONTAINER_NAME}_ccache" || true
2729
docker volume create "${CONTAINER_NAME}_depends" || true
2830
docker volume create "${CONTAINER_NAME}_depends_sources" || true
2931
docker volume create "${CONTAINER_NAME}_previous_releases" || true
3032

33+
docker network create --ipv6 --subnet 1111:1111::/112 ci-ip6net || true
34+
3135
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
3236
echo "Restart docker before run to stop and clear all containers started with --rm"
3337
podman container rm --force --all # Similar to "systemctl restart docker"
@@ -54,6 +58,7 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
5458
--mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \
5559
--env-file /tmp/env-$USER-$CONTAINER_NAME \
5660
--name "$CONTAINER_NAME" \
61+
--network ci-ip6net \
5762
"$CONTAINER_NAME")
5863
export CI_CONTAINER_ID
5964
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"

0 commit comments

Comments
 (0)