summaryrefslogtreecommitdiffstats
path: root/.cirrus.yml
blob: 550cbb4f71156f7ae258be9752f76fe2caa04073 (plain)
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
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 12.3
          freebsd_instance:
            image: freebsd-12-3-release-amd64
            << : *freebsd_resource_settings
        - name: FreeBSD 13.1
          freebsd_instance:
            image: freebsd-13-1-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 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: 8
    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 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
        - 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 "make"
        - 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:/usr/local/opt/python/libexec/bin:/usr/local/opt/make/libexec/gnubin:$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
    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.59.0

task:
    name: Code formatting
    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: 8

    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.59.0
        - name: MSRV, GCC 12 (Ubuntu 22.04)
          container:
            greedy: true
            dockerfile: docker/ubuntu_22.04-build-tools.dockerfile
            docker_arguments:
                cxx_package: g++-12
                cc: gcc-12
                cxx: g++-12
                rust_version: 1.59.0

        - name: GCC 12, more warnings and checks (Ubuntu 22.04)
          container:
            greedy: true
            dockerfile: docker/ubuntu_22.04-build-tools.dockerfile
            docker_arguments:
                cxx_package: g++-12
                cc: gcc-12
                cxx: g++-12
          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 22.04)
          container:
            greedy: true
            dockerfile: docker/ubuntu_22.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