|
| 1 | +env: # Global defaults |
| 2 | + CIRRUS_CLONE_DEPTH: 1 |
| 3 | + PACKAGE_MANAGER_INSTALL: "apt-get update && apt-get install -y" |
| 4 | + MAKEJOBS: "-j10" |
| 5 | + TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache |
| 6 | + CI_FAILFAST_TEST_LEAVE_DANGLING: "1" # Cirrus CI does not care about dangling processes and setting this variable avoids killing the CI script itself on error |
| 7 | + CCACHE_MAXSIZE: "200M" |
| 8 | + CCACHE_DIR: "/tmp/ccache_dir" |
| 9 | + CCACHE_NOHASHDIR: "1" # Debug info might contain a stale path if the build dir changes, but this is fine |
| 10 | + |
| 11 | +# A self-hosted machine(s) can be used via Cirrus CI. It can be configured with |
| 12 | +# multiple users to run tasks in parallel. No sudo permission is required. |
| 13 | +# |
| 14 | +# https://cirrus-ci.org/guide/persistent-workers/ |
| 15 | +# |
| 16 | +# Generally, a persistent worker must run Ubuntu 23.04+ or Debian 12+. |
| 17 | +# |
| 18 | +# The following specific types should exist, with the following requirements: |
| 19 | +# - small: For an x86_64 machine, recommended to have 2 CPUs and 8 GB of memory. |
| 20 | +# - medium: For an x86_64 machine, recommended to have 4 CPUs and 16 GB of memory. |
| 21 | +# - arm64: For an aarch64 machine, recommended to have 2 CPUs and 8 GB of memory. |
| 22 | +# |
| 23 | +# CI jobs for the latter configuration can be run on x86_64 hardware |
| 24 | +# by installing qemu-user-static, which works out of the box with |
| 25 | +# podman or docker. Background: https://stackoverflow.com/a/72890225/313633 |
| 26 | +# |
| 27 | +# The above machine types are matched to each task by their label. Refer to the |
| 28 | +# Cirrus CI docs for more details. |
| 29 | +# |
| 30 | +# When a contributor maintains a fork of the repo, any pull request they make |
| 31 | +# to their own fork, or to the main repository, will trigger two CI runs: |
| 32 | +# one for the branch push and one for the pull request. |
| 33 | +# This can be avoided by setting SKIP_BRANCH_PUSH=true as a custom env variable |
| 34 | +# in Cirrus repository settings, accessible from |
| 35 | +# https://cirrus-ci.com/github/my-organization/my-repository |
| 36 | +# |
| 37 | +# On machines that are persisted between CI jobs, RESTART_CI_DOCKER_BEFORE_RUN=1 |
| 38 | +# ensures that previous containers and artifacts are cleared before each run. |
| 39 | +# This requires installing Podman instead of Docker. |
| 40 | +# |
| 41 | +# Futhermore: |
| 42 | +# - apt-get is required due to PACKAGE_MANAGER_INSTALL |
| 43 | +# - podman-docker-4.1+ is required due to the bugfix in 4.1 |
| 44 | +# (https://github.com/bitcoin/bitcoin/pull/21652#issuecomment-1657098200) |
| 45 | +# - The ./ci/ dependencies (with cirrus-cli) should be installed. One-liner example |
| 46 | +# for a single user setup with sudo permission: |
| 47 | +# |
| 48 | +# ``` |
| 49 | +# apt update && apt install git screen python3 bash podman-docker curl -y && curl -L -o cirrus "https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-linux-$(dpkg --print-architecture)" && mv cirrus /usr/local/bin/cirrus && chmod +x /usr/local/bin/cirrus |
| 50 | +# ``` |
| 51 | +# |
| 52 | +# - There are no strict requirements on the hardware. Having fewer CPU threads |
| 53 | +# than recommended merely causes the CI script to run slower. |
| 54 | +# To avoid rare and intermittent OOM due to short memory usage spikes, |
| 55 | +# it is recommended to add (and persist) swap: |
| 56 | +# |
| 57 | +# ``` |
| 58 | +# fallocate -l 16G /swapfile_ci && chmod 600 /swapfile_ci && mkswap /swapfile_ci && swapon /swapfile_ci && ( echo '/swapfile_ci none swap sw 0 0' | tee -a /etc/fstab ) |
| 59 | +# ``` |
| 60 | +# |
| 61 | +# - To register the persistent worker, open a `screen` session and run: |
| 62 | +# |
| 63 | +# ``` |
| 64 | +# RESTART_CI_DOCKER_BEFORE_RUN=1 screen cirrus worker run --labels type=todo_fill_in_type --token todo_fill_in_token |
| 65 | +# ``` |
| 66 | + |
| 67 | +# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks |
| 68 | +filter_template: &FILTER_TEMPLATE |
| 69 | + # Allow forks to specify SKIP_BRANCH_PUSH=true and skip CI runs when a branch is pushed, |
| 70 | + # but still run CI when a PR is created. |
| 71 | + # https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution |
| 72 | + skip: $SKIP_BRANCH_PUSH == "true" && $CIRRUS_PR == "" |
| 73 | + stateful: false # https://cirrus-ci.org/guide/writing-tasks/#stateful-tasks |
| 74 | + |
| 75 | +base_template: &BASE_TEMPLATE |
| 76 | + << : *FILTER_TEMPLATE |
| 77 | + merge_base_script: |
| 78 | + # Unconditionally install git (used in fingerprint_script). |
| 79 | + - git --version || bash -c "$PACKAGE_MANAGER_INSTALL git" |
| 80 | + - if [ "$CIRRUS_PR" = "" ]; then exit 0; fi |
| 81 | + - git fetch --depth=1 $CIRRUS_REPO_CLONE_URL "pull/${CIRRUS_PR}/merge" |
| 82 | + - git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts |
| 83 | + # Also, the merge commit is used to lint COMMIT_RANGE="HEAD~..HEAD" |
| 84 | + |
| 85 | +main_template: &MAIN_TEMPLATE |
| 86 | + timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out |
| 87 | + ci_script: |
| 88 | + - ./ci/test_run_all.sh |
| 89 | + |
| 90 | +global_task_template: &GLOBAL_TASK_TEMPLATE |
| 91 | + << : *BASE_TEMPLATE |
| 92 | + << : *MAIN_TEMPLATE |
| 93 | + |
| 94 | +compute_credits_template: &CREDITS_TEMPLATE |
| 95 | + # https://cirrus-ci.org/pricing/#compute-credits |
| 96 | + # Only use credits for pull requests to the main repo |
| 97 | + use_compute_credits: $CIRRUS_REPO_FULL_NAME == 'bitcoin/bitcoin' && $CIRRUS_PR != "" |
| 98 | + |
| 99 | +task: |
| 100 | + name: 'lint' |
| 101 | + << : *BASE_TEMPLATE |
| 102 | + container: |
| 103 | + image: debian:bookworm |
| 104 | + cpu: 1 |
| 105 | + memory: 1G |
| 106 | + # For faster CI feedback, immediately schedule the linters |
| 107 | + << : *CREDITS_TEMPLATE |
| 108 | + test_runner_cache: |
| 109 | + folder: "/lint_test_runner" |
| 110 | + fingerprint_script: echo $CIRRUS_TASK_NAME $(git rev-parse HEAD:test/lint/test_runner) |
| 111 | + python_cache: |
| 112 | + folder: "/python_build" |
| 113 | + fingerprint_script: cat .python-version /etc/os-release |
| 114 | + unshallow_script: |
| 115 | + - git fetch --unshallow --no-tags |
| 116 | + lint_script: |
| 117 | + - ./ci/lint_run_all.sh |
| 118 | + |
| 119 | +task: |
| 120 | + name: 'tidy' |
| 121 | + << : *GLOBAL_TASK_TEMPLATE |
| 122 | + persistent_worker: |
| 123 | + labels: |
| 124 | + type: medium |
| 125 | + env: |
| 126 | + FILE_ENV: "./ci/test/00_setup_env_native_tidy.sh" |
| 127 | + |
| 128 | +task: |
| 129 | + name: 'ARM, unit tests, no functional tests' |
| 130 | + << : *GLOBAL_TASK_TEMPLATE |
| 131 | + persistent_worker: |
| 132 | + labels: |
| 133 | + type: arm64 # Use arm64 worker to sidestep qemu and avoid a slow CI: https://github.com/bitcoin/bitcoin/pull/28087#issuecomment-1649399453 |
| 134 | + env: |
| 135 | + FILE_ENV: "./ci/test/00_setup_env_arm.sh" |
| 136 | + |
| 137 | +task: |
| 138 | + name: 'Win64, unit tests, no gui tests, no functional tests' |
| 139 | + << : *GLOBAL_TASK_TEMPLATE |
| 140 | + persistent_worker: |
| 141 | + labels: |
| 142 | + type: small |
| 143 | + env: |
| 144 | + FILE_ENV: "./ci/test/00_setup_env_win64.sh" |
| 145 | + |
| 146 | +task: |
| 147 | + name: '32-bit CentOS, dash, gui' |
| 148 | + << : *GLOBAL_TASK_TEMPLATE |
| 149 | + persistent_worker: |
| 150 | + labels: |
| 151 | + type: small |
| 152 | + env: |
| 153 | + FILE_ENV: "./ci/test/00_setup_env_i686_centos.sh" |
| 154 | + |
| 155 | +task: |
| 156 | + name: 'previous releases, depends DEBUG' |
| 157 | + << : *GLOBAL_TASK_TEMPLATE |
| 158 | + persistent_worker: |
| 159 | + labels: |
| 160 | + type: small |
| 161 | + env: |
| 162 | + FILE_ENV: "./ci/test/00_setup_env_native_previous_releases.sh" |
| 163 | + |
| 164 | +task: |
| 165 | + name: 'TSan, depends, gui' |
| 166 | + << : *GLOBAL_TASK_TEMPLATE |
| 167 | + persistent_worker: |
| 168 | + labels: |
| 169 | + type: medium |
| 170 | + env: |
| 171 | + FILE_ENV: "./ci/test/00_setup_env_native_tsan.sh" |
| 172 | + |
| 173 | +task: |
| 174 | + name: 'MSan, depends' |
| 175 | + << : *GLOBAL_TASK_TEMPLATE |
| 176 | + persistent_worker: |
| 177 | + labels: |
| 178 | + type: small |
| 179 | + timeout_in: 300m # Use longer timeout for the *rare* case where a full build (llvm + msan + depends + ...) needs to be done. |
| 180 | + env: |
| 181 | + FILE_ENV: "./ci/test/00_setup_env_native_msan.sh" |
| 182 | + |
| 183 | +task: |
| 184 | + name: 'fuzzer,address,undefined,integer, no depends' |
| 185 | + << : *GLOBAL_TASK_TEMPLATE |
| 186 | + persistent_worker: |
| 187 | + labels: |
| 188 | + type: medium |
| 189 | + env: |
| 190 | + FILE_ENV: "./ci/test/00_setup_env_native_fuzz.sh" |
| 191 | + |
| 192 | +task: |
| 193 | + name: 'multiprocess, i686, DEBUG' |
| 194 | + << : *GLOBAL_TASK_TEMPLATE |
| 195 | + persistent_worker: |
| 196 | + labels: |
| 197 | + type: medium |
| 198 | + env: |
| 199 | + FILE_ENV: "./ci/test/00_setup_env_i686_multiprocess.sh" |
| 200 | + |
| 201 | +task: |
| 202 | + name: 'no wallet, libbitcoinkernel' |
| 203 | + << : *GLOBAL_TASK_TEMPLATE |
| 204 | + persistent_worker: |
| 205 | + labels: |
| 206 | + type: small |
| 207 | + env: |
| 208 | + FILE_ENV: "./ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh" |
| 209 | + |
| 210 | +task: |
| 211 | + name: 'macOS-cross, gui, no tests' |
| 212 | + << : *GLOBAL_TASK_TEMPLATE |
| 213 | + persistent_worker: |
| 214 | + labels: |
| 215 | + type: small |
| 216 | + env: |
| 217 | + FILE_ENV: "./ci/test/00_setup_env_mac_cross.sh" |
0 commit comments