|
1 | | -### Global defaults |
2 | | - |
3 | | -env: |
| 1 | +env: # Global defaults |
| 2 | + CIRRUS_CLONE_DEPTH: 1 |
4 | 3 | PACKAGE_MANAGER_INSTALL: "apt-get update && apt-get install -y" |
5 | | - MAKEJOBS: "-j4" |
| 4 | + MAKEJOBS: "-j10" |
6 | 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 |
7 | | - CCACHE_SIZE: "200M" |
| 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 | 8 | CCACHE_DIR: "/tmp/ccache_dir" |
9 | 9 | CCACHE_NOHASHDIR: "1" # Debug info might contain a stale path if the build dir changes, but this is fine |
10 | 10 |
|
11 | | -cirrus_ephemeral_worker_template_env: &CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
12 | | - DANGER_RUN_CI_ON_HOST: "1" # Containers will be discarded after the run, so there is no risk that the ci scripts modify the system |
13 | | - |
14 | | -persistent_worker_template_env: &PERSISTENT_WORKER_TEMPLATE_ENV |
15 | | - RESTART_CI_DOCKER_BEFORE_RUN: "1" |
16 | | - |
17 | | -persistent_worker_template: &PERSISTENT_WORKER_TEMPLATE |
18 | | - persistent_worker: {} # https://cirrus-ci.org/guide/persistent-workers/ |
| 11 | +# https://cirrus-ci.org/guide/persistent-workers/ |
| 12 | +# |
| 13 | +# It is possible to select a specific persistent worker by label. Refer to the |
| 14 | +# Cirrus CI docs for more details. |
| 15 | +# |
| 16 | +# Generally, a persistent worker must run Ubuntu 23.04+ or Debian 12+. |
| 17 | +# Specifically, |
| 18 | +# - apt-get is required due to PACKAGE_MANAGER_INSTALL |
| 19 | +# - podman-docker-4.1+ is required due to the use of `podman` when |
| 20 | +# RESTART_CI_DOCKER_BEFORE_RUN is set and 4.1+ due to the bugfix in 4.1 |
| 21 | +# (https://github.com/digibyte/digibyte/pull/21652#issuecomment-1657098200) |
| 22 | +# - The ./ci/ depedencies (with cirrus-cli) should be installed: |
| 23 | +# |
| 24 | +# ``` |
| 25 | +# apt update && apt install 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 |
| 26 | +# ``` |
| 27 | +# |
| 28 | +# - There are no strict requirements on the hardware, because having less CPUs |
| 29 | +# runs the same CI script (maybe slower). To avoid rare and intermittent OOM |
| 30 | +# due to short memory usage spikes, it is recommended to add (and persist) |
| 31 | +# swap: |
| 32 | +# |
| 33 | +# ``` |
| 34 | +# 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 ) |
| 35 | +# ``` |
| 36 | +# |
| 37 | +# - To register the persistent worker, open a `screen` session and run: |
| 38 | +# |
| 39 | +# ``` |
| 40 | +# RESTART_CI_DOCKER_BEFORE_RUN=1 screen cirrus worker run --labels type=todo_fill_in_type --token todo_fill_in_token |
| 41 | +# ``` |
| 42 | +# |
| 43 | +# The following specific types should exist, with the following requirements: |
| 44 | +# - small: For an x86_64 machine, recommended to have 2 CPUs and 8 GB of memory. |
| 45 | +# - 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. |
| 47 | +# - arm64: For an aarch64 machine, recommended to have 2 CPUs and 8 GB of memory. |
19 | 48 |
|
20 | 49 | # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks |
21 | | -base_template: &BASE_TEMPLATE |
| 50 | +filter_template: &FILTER_TEMPLATE |
22 | 51 | skip: $CIRRUS_REPO_FULL_NAME == "digibyte-core/gui" && $CIRRUS_PR == "" # No need to run on the read-only mirror, unless it is a PR. https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution |
| 52 | + stateful: false # https://cirrus-ci.org/guide/writing-tasks/#stateful-tasks |
| 53 | + |
| 54 | +base_template: &BASE_TEMPLATE |
| 55 | + << : *FILTER_TEMPLATE |
23 | 56 | merge_base_script: |
24 | | - - if [ "$CIRRUS_PR" = "" ]; then exit 0; fi |
| 57 | + # Unconditionally install git (used in fingerprint_script). |
25 | 58 | - bash -c "$PACKAGE_MANAGER_INSTALL git" |
26 | | - - git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH |
27 | | - - git config --global user.email "ci@ci.ci" |
28 | | - - git config --global user.name "ci" |
29 | | - - git merge FETCH_HEAD # Merge base to detect silent merge conflicts |
30 | | - stateful: false # https://cirrus-ci.org/guide/writing-tasks/#stateful-tasks |
| 59 | + - if [ "$CIRRUS_PR" = "" ]; then exit 0; fi |
| 60 | + - git fetch --depth=1 $CIRRUS_REPO_CLONE_URL "pull/${CIRRUS_PR}/merge" |
| 61 | + - git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts |
| 62 | + # Also, the merge commit is used to lint COMMIT_RANGE="HEAD~..HEAD" |
31 | 63 |
|
32 | | -global_task_template: &GLOBAL_TASK_TEMPLATE |
33 | | - << : *BASE_TEMPLATE |
| 64 | +main_template: &MAIN_TEMPLATE |
34 | 65 | timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out |
35 | | - container: |
36 | | - # https://cirrus-ci.org/faq/#are-there-any-limits |
37 | | - # Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel |
38 | | - cpu: 2 |
39 | | - memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers |
40 | | - ccache_cache: |
41 | | - folder: "/tmp/ccache_dir" |
42 | | - depends_built_cache: |
43 | | - folder: "depends/built" |
44 | 66 | ci_script: |
45 | 67 | - ./ci/test_run_all.sh |
46 | 68 |
|
47 | | -depends_sdk_cache_template: &DEPENDS_SDK_CACHE_TEMPLATE |
48 | | - depends_sdk_cache: |
49 | | - folder: "depends/sdk-sources" |
| 69 | +global_task_template: &GLOBAL_TASK_TEMPLATE |
| 70 | + << : *BASE_TEMPLATE |
| 71 | + << : *MAIN_TEMPLATE |
50 | 72 |
|
51 | 73 | compute_credits_template: &CREDITS_TEMPLATE |
52 | 74 | # https://cirrus-ci.org/pricing/#compute-credits |
53 | 75 | # Only use credits for pull requests to the main repo |
54 | 76 | use_compute_credits: $CIRRUS_REPO_FULL_NAME == 'digibyte/digibyte' && $CIRRUS_PR != "" |
55 | 77 |
|
56 | | -#task: |
57 | | -# name: "Windows" |
58 | | -# windows_container: |
59 | | -# image: cirrusci/windowsservercore:2019 |
60 | | -# env: |
61 | | -# CIRRUS_SHELL: powershell |
62 | | -# PATH: 'C:\Python37;C:\Python37\Scripts;%PATH%' |
63 | | -# PYTHONUTF8: 1 |
64 | | -# QT_DOWNLOAD_URL: 'https://github.com/sipsorcery/qt_win_binary/releases/download/v1.6/Qt5.9.8_x64_static_vs2019.zip' |
65 | | -# QT_DOWNLOAD_HASH: '9a8c6eb20967873785057fdcd329a657c7f922b0af08c5fde105cc597dd37e21' |
66 | | -# QT_LOCAL_PATH: 'C:\Qt5.9.8_x64_static_vs2019' |
67 | | -# VCPKG_INSTALL_PATH: 'C:\tools\vcpkg\installed' |
68 | | -# VCPKG_COMMIT_ID: 'ed0df8ecc4ed7e755ea03e18aaf285fd9b4b4a74' |
69 | | -# install_script: |
70 | | -# - choco install python --version=3.7.7 -y |
71 | | - |
72 | 78 | task: |
73 | | - name: 'lint [bionic]' |
| 79 | + name: 'lint' |
74 | 80 | << : *BASE_TEMPLATE |
75 | 81 | container: |
76 | | - image: ubuntu:bionic # For python 3.6, oldest supported version according to doc/dependencies.md |
| 82 | + image: debian:bookworm |
77 | 83 | cpu: 1 |
78 | 84 | memory: 1G |
79 | 85 | # For faster CI feedback, immediately schedule the linters |
80 | 86 | << : *CREDITS_TEMPLATE |
| 87 | + python_cache: |
| 88 | + folder: "/python_build" |
| 89 | + fingerprint_script: cat .python-version /etc/os-release |
| 90 | + unshallow_script: |
| 91 | + - git fetch --unshallow --no-tags |
81 | 92 | lint_script: |
82 | 93 | - ./ci/lint_run_all.sh |
| 94 | + |
| 95 | +task: |
| 96 | + name: 'tidy' |
| 97 | + << : *GLOBAL_TASK_TEMPLATE |
| 98 | + persistent_worker: |
| 99 | + labels: |
| 100 | + type: medium |
83 | 101 | env: |
84 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
| 102 | + FILE_ENV: "./ci/test/00_setup_env_native_tidy.sh" |
85 | 103 |
|
86 | 104 | task: |
87 | | - name: 'ARM [unit tests, no functional tests] [buster]' |
| 105 | + name: 'ARM, unit tests, no functional tests' |
88 | 106 | << : *GLOBAL_TASK_TEMPLATE |
89 | | - container: |
90 | | - image: debian:buster |
| 107 | + persistent_worker: |
| 108 | + labels: |
| 109 | + type: arm64 # Use arm64 worker to sidestep qemu and avoid a slow CI: https://github.com/digibyte/digibyte/pull/28087#issuecomment-1649399453 |
91 | 110 | env: |
92 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
93 | 111 | FILE_ENV: "./ci/test/00_setup_env_arm.sh" |
94 | 112 |
|
95 | 113 | task: |
96 | | - name: 'Win64 [unit tests, no gui tests, no boost::process, no functional tests] [focal]' |
| 114 | + name: 'Win64, unit tests, no gui tests, no boost::process, no functional tests' |
97 | 115 | << : *GLOBAL_TASK_TEMPLATE |
98 | | - container: |
99 | | - image: ubuntu:focal |
| 116 | + persistent_worker: |
| 117 | + labels: |
| 118 | + type: small |
100 | 119 | env: |
101 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
102 | 120 | FILE_ENV: "./ci/test/00_setup_env_win64.sh" |
103 | 121 |
|
104 | 122 | task: |
105 | | - name: '32-bit + dash [gui] [CentOS 8]' |
| 123 | + name: '32-bit CentOS, dash, gui' |
106 | 124 | << : *GLOBAL_TASK_TEMPLATE |
107 | | - container: |
108 | | - image: centos:8 |
| 125 | + persistent_worker: |
| 126 | + labels: |
| 127 | + type: small |
109 | 128 | env: |
110 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
111 | | - PACKAGE_MANAGER_INSTALL: "yum install -y" |
112 | 129 | FILE_ENV: "./ci/test/00_setup_env_i686_centos.sh" |
113 | 130 |
|
114 | 131 | task: |
115 | | - name: '[previous releases, uses qt5 dev package and some depends packages, DEBUG] [unsigned char] [bionic]' |
116 | | - previous_releases_cache: |
117 | | - folder: "releases" |
| 132 | + name: 'previous releases, qt5 dev package and depends packages, DEBUG' |
118 | 133 | << : *GLOBAL_TASK_TEMPLATE |
119 | | - << : *PERSISTENT_WORKER_TEMPLATE |
| 134 | + persistent_worker: |
| 135 | + labels: |
| 136 | + type: small |
120 | 137 | env: |
121 | | - << : *PERSISTENT_WORKER_TEMPLATE_ENV |
122 | 138 | FILE_ENV: "./ci/test/00_setup_env_native_qt5.sh" |
123 | 139 |
|
124 | 140 | task: |
125 | | - name: '[depends, sanitizers: thread (TSan), no gui] [jammy]' |
| 141 | + name: 'TSan, depends, gui' |
126 | 142 | << : *GLOBAL_TASK_TEMPLATE |
127 | | - container: |
128 | | - image: ubuntu:jammy |
129 | | - cpu: 6 # Increase CPU and Memory to avoid timeout |
130 | | - memory: 24G |
| 143 | + persistent_worker: |
| 144 | + labels: |
| 145 | + type: medium |
131 | 146 | env: |
132 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
133 | | - MAKEJOBS: "-j8" |
134 | 147 | FILE_ENV: "./ci/test/00_setup_env_native_tsan.sh" |
135 | 148 |
|
136 | 149 | task: |
137 | | - name: '[depends, sanitizers: memory (MSan)] [focal]' |
| 150 | + name: 'MSan, depends' |
138 | 151 | << : *GLOBAL_TASK_TEMPLATE |
139 | | - container: |
140 | | - image: ubuntu:focal |
| 152 | + persistent_worker: |
| 153 | + labels: |
| 154 | + type: small |
| 155 | + timeout_in: 300m # Use longer timeout for the *rare* case where a full build (llvm + msan + depends + ...) needs to be done. |
141 | 156 | env: |
142 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
143 | 157 | FILE_ENV: "./ci/test/00_setup_env_native_msan.sh" |
144 | 158 |
|
145 | 159 | task: |
146 | | - name: '[no depends, sanitizers: address/leak (ASan + LSan) + undefined (UBSan) + integer] [jammy]' |
| 160 | + name: 'ASan + LSan + UBSan + integer, no depends, USDT' |
| 161 | + enable_bpfcc_script: |
| 162 | + # In the image build step, no external environment variables are available, |
| 163 | + # so any settings will need to be written to the settings env file: |
| 164 | + - sed -i "s|\${CIRRUS_CI}|true|g" ./ci/test/00_setup_env_native_asan.sh |
147 | 165 | << : *GLOBAL_TASK_TEMPLATE |
148 | | - container: |
149 | | - image: ubuntu:jammy |
| 166 | + persistent_worker: |
| 167 | + labels: |
| 168 | + type: noble # Must use this specific worker (needed for USDT functional tests) |
150 | 169 | env: |
151 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
152 | 170 | FILE_ENV: "./ci/test/00_setup_env_native_asan.sh" |
153 | 171 |
|
154 | 172 | task: |
155 | | - name: '[no depends, sanitizers: fuzzer,address,undefined,integer] [focal]' |
| 173 | + name: 'fuzzer,address,undefined,integer, no depends' |
156 | 174 | << : *GLOBAL_TASK_TEMPLATE |
157 | | - container: |
158 | | - image: ubuntu:focal |
159 | | - cpu: 4 # Increase CPU and memory to avoid timeout |
160 | | - memory: 16G |
| 175 | + persistent_worker: |
| 176 | + labels: |
| 177 | + type: medium |
161 | 178 | env: |
162 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
163 | | - MAKEJOBS: "-j8" |
164 | 179 | FILE_ENV: "./ci/test/00_setup_env_native_fuzz.sh" |
165 | 180 |
|
166 | 181 | task: |
167 | | - name: '[multiprocess, DEBUG] [focal]' |
| 182 | + name: 'multiprocess, i686, DEBUG' |
168 | 183 | << : *GLOBAL_TASK_TEMPLATE |
169 | | - container: |
170 | | - image: ubuntu:focal |
171 | | - cpu: 4 |
172 | | - memory: 16G # The default memory is sometimes just a bit too small, so double everything |
| 184 | + persistent_worker: |
| 185 | + labels: |
| 186 | + type: medium |
173 | 187 | env: |
174 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
175 | | - MAKEJOBS: "-j8" |
176 | | - FILE_ENV: "./ci/test/00_setup_env_native_multiprocess.sh" |
| 188 | + FILE_ENV: "./ci/test/00_setup_env_i686_multiprocess.sh" |
177 | 189 |
|
178 | 190 | task: |
179 | | - name: '[no wallet] [bionic]' |
| 191 | + name: 'no wallet, libdigibytekernel' |
180 | 192 | << : *GLOBAL_TASK_TEMPLATE |
181 | | - container: |
182 | | - image: ubuntu:bionic |
| 193 | + persistent_worker: |
| 194 | + labels: |
| 195 | + type: small |
183 | 196 | env: |
184 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
185 | | - FILE_ENV: "./ci/test/00_setup_env_native_nowallet.sh" |
| 197 | + FILE_ENV: "./ci/test/00_setup_env_native_nowallet_libdigibytekernel.sh" |
186 | 198 |
|
187 | 199 | task: |
188 | | - name: 'macOS 10.15 [gui, no tests] [focal]' |
189 | | - << : *BASE_TEMPLATE |
190 | | - macos_sdk_cache: |
191 | | - folder: "depends/SDKs/$MACOS_SDK" |
192 | | - fingerprint_key: "$MACOS_SDK" |
193 | | - << : *MAIN_TEMPLATE |
194 | | - container: |
195 | | - image: ubuntu:focal |
196 | | - env: |
197 | | - MACOS_SDK: "Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers" |
198 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
199 | | - FILE_ENV: "./ci/test/00_setup_env_mac.sh" |
200 | | - |
201 | | -task: |
202 | | - name: 'macOS 12 native [gui, system sqlite only] [no depends]' |
203 | | - brew_install_script: |
204 | | - - brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt |
205 | | - << : *GLOBAL_TASK_TEMPLATE |
206 | | - osx_instance: |
207 | | - # Use latest image, but hardcode version to avoid silent upgrades (and breaks) |
208 | | - image: monterey-xcode-13.2 # https://cirrus-ci.org/guide/macOS |
209 | | - env: |
210 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
211 | | - CI_USE_APT_INSTALL: "no" |
212 | | - PACKAGE_MANAGER_INSTALL: "echo" # Nothing to do |
213 | | - FILE_ENV: "./ci/test/00_setup_env_mac_host.sh" |
214 | | - |
215 | | -task: |
216 | | - name: 'ARM64 Android APK [focal]' |
217 | | - << : *DEPENDS_SDK_CACHE_TEMPLATE |
218 | | - depends_sources_cache: |
219 | | - folder: "depends/sources" |
| 200 | + name: 'macOS-cross 11.0, gui, no tests' |
220 | 201 | << : *GLOBAL_TASK_TEMPLATE |
221 | | - container: |
222 | | - image: ubuntu:focal |
| 202 | + persistent_worker: |
| 203 | + labels: |
| 204 | + type: small |
223 | 205 | env: |
224 | | - << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV |
225 | | - FILE_ENV: "./ci/test/00_setup_env_android.sh" |
| 206 | + FILE_ENV: "./ci/test/00_setup_env_mac.sh" |
0 commit comments