forked from newsboat/newsboat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
501 lines (460 loc) · 19.2 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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
freebsd_resource_settings: &freebsd_resource_settings
cpu: 4
memory: 8GB
task:
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'docker/*', 'docker/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
matrix:
- name: FreeBSD 11.4
freebsd_instance:
image: freebsd-11-4-release-amd64
<< : *freebsd_resource_settings
- name: FreeBSD 12.2
freebsd_instance:
image: freebsd-12-2-release-amd64
<< : *freebsd_resource_settings
- name: FreeBSD 13.0
freebsd_instance:
image: freebsd-13-0-release-amd64
<< : *freebsd_resource_settings
cargo_cache: &cargo_cache
# This works in conjunction with after_cache_script and
# before_cache_script defined below.
folder: $HOME/cargo-cache
fingerprint_script:
# We include the cache name in the fingerprint to avoid re-using old
# caches that contained ~/.cargo
- echo cargo-cache
- cat Cargo.lock
env:
HOME: /home/testuser
RUSTFLAGS: '-D warnings'
after_cache_script: &after_cache_script
- mkdir $HOME/.cargo || true
- mv $HOME/cargo-cache/registry/ $HOME/cargo-cache/git/ $HOME/.cargo/ || true
install_script:
# Make sure we use the same package repository for all images. Snapshots
# (like 11.3-STABLE) default to latest, while releases default to quarterly.
- sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
- pkg update -f
- pkg upgrade -y
- pkg install -y rust gmake rubygem-asciidoctor pkgconf stfl curl json-c ncurses openssl sqlite3 gettext-tools libxml2
setup_script:
- pw groupadd testgroup
- pw useradd testuser -g testgroup -w none -m
- cp -R . $HOME
- chown -R testuser:testgroup $HOME
# CI builds take a while to provision, install dependencies and compile our
# stuff. To maximize the benefits, we ask Make to process as many rules as
# possible before failing. This enables developers to fix more errors before
# re-submitting the code to CI, which should increase throughput.
build_script: su testuser -c 'cd ~ && gmake --jobs=5 --keep-going all test'
test_script: su testuser -c 'cd ~ && RUST_TEST_THREADS=5 RUST_BACKTRACE=1 gmake -j5 NEWSBOAT_RUN_IGNORED_TESTS=1 ci-check'
# This installs everything into a "fake filesystem root", then uninstalls
# everything and checks that there are no files left over. The purpose of
# this check is to ensure that: 1) `make install` doesn't fail; 2) `make
# uninstall` cleans up everything that `make install` installed.
#
# We run this *before* Clippy because Clippy rebuilds crates in debug mode,
# which causes some C++ classes to be re-compiled as they depend on cxx
# bridges.
fake_install_script: su testuser -c 'cd ~ && mkdir fakeroot && gmake DESTDIR=fakeroot install && gmake DESTDIR=fakeroot uninstall && [ $(find fakeroot -type f -print | wc -l) -eq 0 ]'
clippy_script: su testuser -c 'cd ~ && cargo clippy --all-targets --all-features -- -D warnings -A clippy::unknown-clippy-lints -A unknown-lints'
before_cache_script: &before_cache_script
# Cirrus CI sometimes fails to unpack the cache. In that case, it
# removes the "cache folder" and tries again.
#
# We used to use ~/.cargo as a "cache folder", but Cirrus then
# sometimes removed ~/.cargo/bin and broke the build. To work around
# that, we're storing the cacheble stuff in a separate directory which
# we move in/out of ~/.cargo before/after the build.
- mkdir -p $HOME/cargo-cache/git/
- mv $HOME/.cargo/registry/ $HOME/cargo-cache/ || true
- mv $HOME/.cargo/git/db/ $HOME/cargo-cache/git/ || true
task:
name: Linux i686 (Ubuntu 18.04)
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
container:
greedy: true
dockerfile: docker/ubuntu_18.04-i686.dockerfile
cargo_cache: *cargo_cache
env:
RUSTFLAGS: '-D warnings'
JOBS: 10
after_cache_script: *after_cache_script
build_script: &build_script
- make -j${JOBS} --keep-going all test
test_script: &test_script
- RUST_TEST_THREADS=${JOBS} RUST_BACKTRACE=1 make -j${JOBS} NEWSBOAT_RUN_IGNORED_TESTS=1 ci-check
# For explanation of what this script does, please see the FreeBSD job
# above.
fake_install_script: &fake_install_script
- mkdir fakeroot
- make DESTDIR=fakeroot install
- make DESTDIR=fakeroot uninstall
- test $(find fakeroot -type f -print | wc -l) -eq 0
clippy_script: &clippy_script
- cargo clippy --all-targets --all-features -- -D warnings -A clippy::unknown-clippy-lints -A unknown-lints
before_cache_script: *before_cache_script
task:
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'docker/*', 'docker/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
cargo_cache: *cargo_cache
after_cache_script: *after_cache_script
install_script:
- brew update
- brew install rustup-init
- brew install gcc || brew link --overwrite gcc
- brew install python
- export PATH=/usr/local/opt/python/libexec/bin:$PATH
- brew uninstall rbenv ruby-build # ...so that it won't be upgraded when pkg-config is upgraded, because upgrading ruby-build fails; see https://github.com/newsboat/newsboat/issues/866
- brew outdated "pkg-config" || brew upgrade "pkg-config"
- brew install "gettext" && brew link --force "gettext"
- brew outdated "sqlite" || brew upgrade "sqlite"
- brew outdated "curl" || brew upgrade "curl"
- brew install "libstfl"
- brew install "json-c"
- brew install "asciidoctor"
- brew install "libxml2"
- brew install "pyenv" || brew upgrade "pyenv"
- rustup-init -y --default-toolchain $RUST
- rustc --version && cargo --version
env:
GCOV: /usr/bin/gcov
PKG_CONFIG_PATH: /usr/local/opt/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
PATH: $HOME/.cargo/bin:/usr/local/opt/gettext/bin:$PATH
LDFLAGS: -L/usr/local/opt/gettext/lib
CFLAGS: -I/usr/local/opt/gettext/include
CXXFLAGS: -I/usr/local/opt/gettext/include
GETTEXT_DIR: /usr/local/opt/gettext
RUSTFLAGS: '-D warnings'
JOBS: 13
build_script: *build_script
test_script: *test_script
fake_install_script: *fake_install_script
clippy_script: *clippy_script
before_cache_script: *before_cache_script
matrix:
- name: macOS Monterey, Clang, Rust stable
osx_instance:
image: monterey-base
env:
CC: clang
CXX: clang++
RUST: stable
# This job tests our minimum supported Rust version, so only bump on
# Newsboat release day
- name: macOS Big Sur, GCC, MSRV
osx_instance:
image: big-sur-base
env:
CC: gcc
CXX: g++
RUST: 1.55.0
task:
name: Code formatting
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
container:
dockerfile: docker/code-formatting-tools.dockerfile
cpu: 1
memory: 512MB
script:
- make fmt
# --exit-code forces git-diff to exit with code 1 if there were
# changes; that'll fail the build, which is exactly what we need
- git diff --exit-code
task:
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
env:
RUSTFLAGS: '-D warnings'
JOBS: 10
matrix:
# These two jobs test our minimum supported Rust version, so only bump on
# Newsboat release day
- name: MSRV, GCC 5 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-5
cc: gcc-5
cxx: g++-5
rust_version: 1.55.0
- name: MSRV, GCC 11 (Ubuntu 21.04)
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-11
cc: gcc-11
cxx: g++-11
rust_version: 1.55.0
- name: GCC 11, more warnings and checks (Ubuntu 21.04)
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-11
cc: gcc-11
cxx: g++-11
env: &extra_warnings_and_checks_env
CXXFLAGS: "-D_GLIBCXX_ASSERTIONS -Wformat -Wformat-security -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2 -Wnull-dereference -Wdouble-promotion -O3"
- name: Clang 13, more warnings and checks (Ubuntu 21.04)
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-13
cc: clang-13
cxx: clang++-13
env: *extra_warnings_and_checks_env
- name: Rust stable, GCC 5 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-5
cc: gcc-5
cxx: g++-5
- name: Rust stable, GCC 6 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-6
cc: gcc-6
cxx: g++-6
- name: Rust stable, GCC 7 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-7
cc: gcc-7
cxx: g++-7
- name: Rust stable, GCC 8 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-8
cc: gcc-8
cxx: g++-8
- name: Rust stable, GCC 9 (Ubuntu 20.04)
container:
greedy: true
dockerfile: docker/ubuntu_20.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-9
cc: gcc-9
cxx: g++-9
- name: Rust stable, GCC 10 (Ubuntu 20.04)
container:
greedy: true
dockerfile: docker/ubuntu_20.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-10
cc: gcc-10
cxx: g++-10
- name: Rust stable, GCC 11 (Ubuntu 21.04)
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-11
cc: gcc-11
cxx: g++-11
- name: Rust stable, Clang 4.0 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-4.0
cc: clang-4.0
cxx: clang++-4.0
- name: Rust stable, Clang 5.0 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-5.0
cc: clang-5.0
cxx: clang++-5.0
- name: Rust stable, Clang 6.0 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-6.0
cc: clang-6.0
cxx: clang++-6.0
- name: Rust stable, Clang 7 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-7
cc: clang-7
cxx: clang++-7
- name: Rust stable, Clang 8 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-8
cc: clang-8
cxx: clang++-8
- name: Rust stable, Clang 9 (Ubuntu 18.04)
container:
greedy: true
dockerfile: docker/ubuntu_18.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-9
cc: clang-9
cxx: clang++-9
- name: Rust stable, Clang 10 (Ubuntu 20.04)
container:
greedy: true
dockerfile: docker/ubuntu_20.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-10
cc: clang-10
cxx: clang++-10
- name: Rust stable, Clang 11 (Ubuntu 20.10)
container:
greedy: true
dockerfile: docker/ubuntu_20.10-build-tools.dockerfile
docker_arguments:
cxx_package: clang-11
cc: clang-11
cxx: clang++-11
- name: Rust stable, Clang 12 (Ubuntu 21.04)
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-12
cc: clang-12
cxx: clang++-12
- name: Rust stable, Clang 13 (Ubuntu 21.04)
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
cxx_package: clang-13
cc: clang-13
cxx: clang++-13
cargo_cache: *cargo_cache
after_cache_script: *after_cache_script
build_script: *build_script
test_script: *test_script
fake_install_script: *fake_install_script
clippy_script: *clippy_script
before_cache_script: *before_cache_script
task:
name: AddressSanitizer (Clang 13, Ubuntu 21.04)
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
# We need llvm-symbolizer from llvm-13-tools to demangle symbols in
# sanitizer's reports
cxx_package: "clang-13 llvm-13"
cc: clang-13
cxx: clang++-13
env:
CXXFLAGS: "-fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fno-optimize-sibling-calls -g"
ASAN_OPTIONS: "check_initialization_order=1:detect_stack_use_after_return=1"
JOBS: 10
cargo_cache: *cargo_cache
# Sanitizers only apply to C++, so we only build and run C++ tests. Also,
# we don't pass --keep-going to the build: failures can be debugged with
# logs of other jobs.
after_cache_script: *after_cache_script
build_script: make -j${JOBS} test/test
test_script: cd test && ./test --order=rand --rng-seed=time
before_cache_script: *before_cache_script
task:
name: Dependencies list is up to date
skip: "!changesInclude('.cirrus.yml', 'docker/*', 'docker/**/*', '*.{h,cpp}', '**/*.{h,cpp}')"
container:
greedy: true
dockerfile: docker/ubuntu_20.04-build-tools.dockerfile
docker_arguments:
cxx_package: g++-9
cc: gcc-9
cxx: g++-9
env:
JOBS: 10
script:
# Build in debug mode to speed things up
- make -j${JOBS} PROFILE=1 depslist
# --exit-code forces git-diff to exit with code 1 if there were
# changes. If it does, we print a warning, and propagate the error.
# Otherwise this whole script exits with 0
- git diff --exit-code || (echo 'WARNING: the above diff is produced by GCC. Copy it if you only have Clang installed; otherwise just run `make depslist` and commit the result'; false)
task:
name: UB Sanitizer (Clang 13, Ubuntu 21.04)
skip: "changesIncludeOnly('contrib/*', 'contrib/**/*', 'doc/*', 'doc/**/*', 'po/*', 'po/**/*', 'snap/*', 'snap/**/*')"
container:
greedy: true
dockerfile: docker/ubuntu_21.04-build-tools.dockerfile
docker_arguments:
# We need llvm-symbolizer from llvm-13-tools to demangle symbols in
# sanitizer's reports
cxx_package: "clang-13 llvm-13"
cc: clang-13
cxx: clang++-13
env:
CXXFLAGS: "-fsanitize=undefined -g -fno-omit-frame-pointer"
UBSAN_OPTIONS: "suppressions=.undefined-sanitizer-suppressions:print_stacktrace=1:halt_on_error=1"
JOBS: 10
cargo_cache: *cargo_cache
# Sanitizers only apply to C++, so we only build and run C++ tests. Also,
# we don't pass --keep-going to the build: failures can be debugged with
# logs of other jobs.
after_cache_script: *after_cache_script
build_script: make -j${JOBS} test/test
test_script: cd test && ./test --order=rand --rng-seed=time
before_cache_script: *before_cache_script
task:
name: Asciidoctor with warnings-as-errors
skip: "!changesInclude('.cirrus.yml', 'doc/*', 'doc/**/*', 'docker/*', 'docker/**/*')"
container:
cpu: 1
memory: 512MB
dockerfile: docker/ubuntu_20.04-build-tools.dockerfile
env:
ASCIIDOCTOR_OPTS: '--failure-level WARN'
script: make doc
task:
name: .po files
skip: "!changesInclude('.cirrus.yml', 'docker/*', 'docker/**/*', 'po/*.{po,pot}')"
container:
cpu: 1
memory: 512MB
dockerfile: docker/i18nspector.dockerfile
# `tee` displays the output of `i18nspector`, but also store it in the file
# for later analysis. `egrep` returns exit code 0 if it finds something,
# and 1 otherwise. We need the opposite, so we negate the exit code using
# an exclamation mark. This fails the build if the log contains errors or
# warnings.
script: make run-i18nspector | tee i18nspector.log && ! egrep --silent "^(E|W):" i18nspector.log
task:
name: "No dbg! macros in Rust code"
skip: "!changesInclude('.cirrus.yml', '*.rs', '**/*.rs')"
container:
cpu: 1
memory: 512MB
image: alpine:3.10.2
script:
# Alpine uses BusyBox, so grep there doesn't support long options.
#
# -E -- extended regex, which supports beginning-of-word marker
# -r -- recursive
# -n -- show line numbers
#
# `!` in front of the command negates its exit code: this script will now
# exit with 0 if no matches were found, and with 1 if there are matches.
# We need parentheses to prevent YAML parser from eating up the
# exclamation mark.
- ( ! grep -Ern '\<dbg!' * )