-
Notifications
You must be signed in to change notification settings - Fork 40
/
.cirrus.yml
394 lines (331 loc) · 13 KB
/
.cirrus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
#
# Notes
#
# Cirrus CI has a concurrency limit of 24 CPU cores for open source projects.
# This means we should not have more than 12 pipelines with more than 2 CPUs
# in each pipeline running parallel
#
# Documentation:
# - https://cirrus-ci.org/examples/
# - https://cirrus-ci.org/guide/writing-tasks/
#
---
#
# Global environment variables
#
env:
CI_ENABLED: true
# RUSTFLAGS: "-C debug-assertions"
#
# Filter to run the CI only on the main branch or for pull request to the main branch
#
# TODO: check why !$CIRRUS_PR_DRAFT breaks the CI on the main branch
only_if: $CI_ENABLED && ( $CIRRUS_BRANCH == 'main' || ($CIRRUS_PR != '' && $CIRRUS_BASE_BRANCH == 'main'))
#
# Templates
#
# Constants
iox2_task_timeout_template: &IOX2_TASK_TIMEOUT
timeout_in: 45m # This needs to be reasonable large in order not to run in a timeout in the docker image re-builds
iox2_common_cpu_and_memory_config_for_build_and_test_template: &IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
cpu: 2
memory: 4GB
# Container
iox2_container_ubuntu_22_04_x64_template: &IOX2_CONTAINER_UBUNTU_22_04_X64
<<: *IOX2_TASK_TIMEOUT
container:
dockerfile: internal/docker/ubuntu-22.04
<<: *IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
iox2_container_ubuntu_22_04_aarch64_template: &IOX2_CONTAINER_UBUNTU_22_04_AARCH64
<<: *IOX2_TASK_TIMEOUT
arm_container:
dockerfile: internal/docker/ubuntu-22.04
<<: *IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
iox2_container_arch_linux_x64_template: &IOX2_CONTAINER_ARCH_LINUX_X64
<<: *IOX2_TASK_TIMEOUT
container:
dockerfile: internal/docker/archlinux-base-devel
<<: *IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
iox2_container_windows_server_2019_x64_template: &IOX2_CONTAINER_WINDOWS_SERVER_2019_X64
<<: *IOX2_TASK_TIMEOUT
windows_container:
dockerfile: internal/docker/windowsservercore-2019
<<: *IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
iox2_container_freebsd_x64_template: &IOX2_CONTAINER_FREEBSD_X64
<<: *IOX2_TASK_TIMEOUT
freebsd_instance:
image_family: freebsd-14-0
<<: *IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
iox2_container_macos_aarch64_template: &IOX2_CONTAINER_MACOS_AARCH64
<<: *IOX2_TASK_TIMEOUT
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
<<: *IOX2_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILD_AND_TEST
# Build and Test
iox2_cargo_fmt_and_clippy_template: &IOX2_CARGO_FMT_AND_CLIPPY
cargo_fmt_and_clippy_script:
- cargo fmt --all -- --check
- cargo clippy -- -D warnings
iox2_clang_format_and_clang_tidy_template: &IOX2_CLANG_FORMAT_AND_CLANG_TIDY
clang_format_and_clang_tidy_script:
- git ls-files | grep -E "\.(c|cc|cpp|cxx|inl|h|hh|hpp|hxx)$" | xargs clang-format -i -style=file --Werror --dry-run
- git fetch origin main # required to make diff-to-main work
- internal/scripts/clang_tidy_scan.sh warning-as-error diff-to-main
iox2_common_build_debug_template: &IOX2_COMMON_BUILD_DEBUG
build_script: cargo build --workspace --all-targets
iox2_common_build_and_test_debug_template: &IOX2_COMMON_BUILD_AND_TEST_DEBUG
<<: *IOX2_COMMON_BUILD_DEBUG
test_script: cargo nextest run --workspace --all-targets --no-fail-fast
iox2_common_build_release_template: &IOX2_COMMON_BUILD_RELEASE
build_script: cargo build --release --workspace --all-targets
iox2_common_build_and_test_no_doc_tests_release_template: &IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
<<: *IOX2_COMMON_BUILD_RELEASE
test_script: cargo nextest run --release --tests --workspace --all-targets --no-fail-fast
iox2_ffi_common_debug_template: &IOX2_FFI_COMMON_DEBUG
ffi_script:
- ./internal/scripts/ci_build_and_install_iceoryx_hoofs.sh
- cmake -S . -B target/ffi/build -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX=target/ffi/install -DCMAKE_INSTALL_PREFIX="$( pwd )/target/iceoryx/install" -DRUST_BUILD_ARTIFACT_PATH="$( pwd )/target/debug"
- cmake --build target/ffi/build
- cmake --install target/ffi/build
- target/ffi/build/tests/iceoryx2-c-tests
- rm -rf target/ffi/build
- cmake -S examples/c -B target/ffi/out-of-tree-c -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$( pwd )/target/ffi/install;$( pwd )/target/iceoryx/install"
- cmake --build target/ffi/out-of-tree-c
- cmake -S examples/cxx -B target/ffi/out-of-tree-cxx -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$( pwd )/target/ffi/install;$( pwd )/target/iceoryx/install"
- cmake --build target/ffi/out-of-tree-cxx
iox2_ffi_common_release_template: &IOX2_FFI_COMMON_RELEASE
ffi_script:
- ./internal/scripts/ci_build_and_install_iceoryx_hoofs.sh
- cmake -S . -B target/ffi/build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX=target/ffi/install -DCMAKE_INSTALL_PREFIX="$( pwd )/target/iceoryx/install" -DRUST_BUILD_ARTIFACT_PATH="$( pwd )/target/release"
- cmake --build target/ffi/build
- cmake --install target/ffi/build
- target/ffi/build/tests/iceoryx2-c-tests
- rm -rf target/ffi/build
- cmake -S examples/c -B target/ffi/out-of-tree-c -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$( pwd )/target/ffi/install;$( pwd )/target/iceoryx/install"
- cmake --build target/ffi/out-of-tree-c
- cmake -S examples/cxx -B target/ffi/out-of-tree-cxx -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$( pwd )/target/ffi/install;$( pwd )/target/iceoryx/install"
- cmake --build target/ffi/out-of-tree-cxx
iox2_freebsd_setup_template: &IOX2_FREEBSD_SETUP
setup_script:
- uname -a
- pkg install -y git llvm
- pw useradd testuser1
- pw useradd testuser2
- pw groupadd testgroup1
- pw groupadd testgroup2
- kldload mqueuefs
- mkdir -p /mnt/mqueue/
- mount -t mqueuefs null /mnt/mqueue/
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path
- rustup component add clippy rustfmt
#
# Preflight-Check with Ubuntu x86 stable debug
#
preflight_check_task:
<<: *IOX2_CONTAINER_UBUNTU_22_04_X64
set_toolchain_script: rustup default stable
fingerprint_script:
- cargo audit
# TODO iox2-#8: add more preflight-checks here
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_CLANG_FORMAT_AND_CLANG_TIDY
<<: *IOX2_COMMON_BUILD_DEBUG # only build without tests to not slow down other tasks due to failures in flaky tests
doc_script: cargo doc
#
# Ubuntu x86
#
# Pipeline 1
# TODO iox2-#8: Add code coverage
# ubuntu_22_04_x64_stable_debug_coverage_task:
# depends_on: preflight_check
# <<: *IOX2_CONTAINER_UBUNTU_22_04_X64
# set_toolchain_script: rustup default stable
# <<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
# Pipeline 2
ubuntu_22_04_x64_min_version_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_UBUNTU_22_04_X64
set_toolchain_script: rustup default 1.75.0
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
linux_only_doc_test_script: cargo test --doc -- --ignored
ubuntu_22_04_x64_stable_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_UBUNTU_22_04_X64
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
linux_only_doc_test_script: cargo test --doc -- --ignored
ubuntu_22_04_x64_beta_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: ubuntu_22_04_x64_stable_debug
<<: *IOX2_CONTAINER_UBUNTU_22_04_X64
set_toolchain_script: rustup default beta
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
ubuntu_22_04_x64_nightly_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: ubuntu_22_04_x64_beta_debug
allow_failures: true
<<: *IOX2_CONTAINER_UBUNTU_22_04_X64
set_toolchain_script: rustup default nightly
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
# Pipeline 3
ubuntu_22_04_x64_stable_release_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_UBUNTU_22_04_X64
set_toolchain_script: rustup default stable
<<: *IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
#
# Ubuntu aarch64
#
# Pipeline 4
ubuntu_22_04_aarch64_min_version_debug_task:
# TODO run only after merge on main branch
only_if: $CIRRUS_BRANCH == 'main'
depends_on: preflight_check
skip: "changesIncludeOnly('.github/**', '**.md')"
<<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64
set_toolchain_script: rustup default 1.75.0
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
ubuntu_22_04_aarch64_stable_debug_task:
depends_on: preflight_check
skip: "changesIncludeOnly('.github/**', '**.md')"
<<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
<<: *IOX2_FFI_COMMON_DEBUG
ubuntu_22_04_aarch64_beta_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: ubuntu_22_04_aarch64_stable_debug
skip: "changesIncludeOnly('.github/**', '**.md')"
allow_failures: true
<<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64
set_toolchain_script: rustup default beta
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
# Pipeline 5
ubuntu_22_04_aarch64_stable_release_task:
# TODO run only after merge on main branch
only_if: $CIRRUS_BRANCH == 'main'
depends_on: preflight_check
skip: "changesIncludeOnly('.github/**', '**.md')"
<<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64
set_toolchain_script: rustup default stable
<<: *IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
<<: *IOX2_FFI_COMMON_RELEASE
#
# Arch Linux x86
#
# Pipeline 6
arch_linux_x64_stable_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
skip: "changesIncludeOnly('.github/**', '**.md')"
<<: *IOX2_CONTAINER_ARCH_LINUX_X64
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
<<: *IOX2_FFI_COMMON_DEBUG
arch_linux_x64_beta_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: arch_linux_x64_stable_debug
skip: "changesIncludeOnly('.github/**', '**.md')"
<<: *IOX2_CONTAINER_ARCH_LINUX_X64
set_toolchain_script: rustup default beta
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
# Pipeline 7
arch_linux_x64_stable_release_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_ARCH_LINUX_X64
set_toolchain_script: rustup default stable
<<: *IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
<<: *IOX2_FFI_COMMON_RELEASE
#
# Windows Server 2019 x86
#
# Pipeline 8
windows_server_2019_x64_stable_debug_task:
# TODO iox2-#43: fix iceoryx2_cal list (underlying shm) tests
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_WINDOWS_SERVER_2019_X64
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
windows_server_2019_x64_stable_release_task:
# TODO iox2-#43: fix iceoryx2_cal list (underlying shm) tests
only_if: false
depends_on: windows_server_2019_x64_stable_debug
<<: *IOX2_CONTAINER_WINDOWS_SERVER_2019_X64
set_toolchain_script: rustup default stable
<<: *IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
#
# FreeBSD
#
# Pipeline 9
freebsd_x64_min_version_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_FREEBSD_X64
env:
PATH: /root/.cargo/bin:$PATH
HOME: /root # must be set manually to '/root' or 'rustup' will throw an error
<<: *IOX2_FREEBSD_SETUP
set_toolchain_script: rustup default 1.75.0
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
freebsd_x64_stable_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_FREEBSD_X64
env:
PATH: /root/.cargo/bin:$PATH
HOME: /root # must be set manually to '/root' or 'rustup' will throw an error
<<: *IOX2_FREEBSD_SETUP
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
#
# macOS
#
# Pipeline 10
macos_aarch64_min_version_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_MACOS_AARCH64
env:
PATH: /Users/admin/.cargo/bin:$PATH
setup_script:
- uname -a
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path
- rustup component add clippy rustfmt
set_toolchain_script: rustup default 1.75.0
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
macos_aarch64_stable_debug_task:
# TODO commented out due to limited CI time
only_if: false
depends_on: preflight_check
<<: *IOX2_CONTAINER_MACOS_AARCH64
env:
PATH: /Users/admin/.cargo/bin:$PATH
setup_script:
- uname -a
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path
- rustup component add clippy rustfmt
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG