Convert range_in and multirange_in to report errors softly.
[pgsql.git] / .cirrus.yml
blob993af88865921e34701f63676297243fb71f0fb9
1 # CI configuration file for CI utilizing cirrus-ci.org
3 # For instructions on how to enable the CI integration in a repository and
4 # further details, see src/tools/ci/README
7 env:
8   # Source of images / containers
9   GCP_PROJECT: pg-ci-images
10   IMAGE_PROJECT: $GCP_PROJECT
11   CONTAINER_REPO: us-docker.pkg.dev/${GCP_PROJECT}/ci
13   # The lower depth accelerates git clone. Use a bit of depth so that
14   # concurrent tasks and retrying older jobs has a chance of working.
15   CIRRUS_CLONE_DEPTH: 500
16   # Useful to be able to analyse what in a script takes long
17   CIRRUS_LOG_TIMESTAMP: true
19   CCACHE_MAXSIZE: "250M"
21   # target to test, for all but windows
22   CHECK: check-world PROVE_FLAGS=$PROVE_FLAGS
23   CHECKFLAGS: -Otarget
24   PROVE_FLAGS: --timer
25   MTEST_ARGS: --print-errorlogs --no-rebuild -C build
26   PGCTLTIMEOUT: 120 # avoids spurious failures during parallel tests
27   TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
28   PG_TEST_EXTRA: kerberos ldap ssl
31 # What files to preserve in case tests fail
32 on_failure_ac: &on_failure_ac
33   log_artifacts:
34     paths:
35       - "**/*.log"
36       - "**/*.diffs"
37       - "**/regress_log_*"
38     type: text/plain
40 on_failure_meson: &on_failure_meson
41   testrun_artifacts:
42     paths:
43       - "build*/testrun/**/*.log"
44       - "build*/testrun/**/*.diffs"
45       - "build*/testrun/**/regress_log_*"
46     type: text/plain
48   # In theory it'd be nice to upload the junit files meson generates, so that
49   # cirrus will nicely annotate the commit. Unfortunately the files don't
50   # contain identifieable file + line numbers right now, so the annotations
51   # don't end up useful. We could probably improve on that with a some custom
52   # conversion script, but ...
53   meson_log_artifacts:
54     path: "build*/meson-logs/*.txt"
55     type: text/plain
58 # To avoid unnecessarily spinning up a lot of VMs / containers for entirely
59 # broken commits, have a minimal task that all others depend on.
60 task:
61   name: SanityCheck
63   # If a specific OS is requested, don't run the sanity check. This shortens
64   # push-wait-for-ci cycle time a bit when debugging operating system specific
65   # failures. Uses skip instead of only_if, as cirrus otherwise warns about
66   # only_if conditions not matching.
67   skip: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*'
69   env:
70     CPUS: 4
71     BUILD_JOBS: 8
72     TEST_JOBS: 8
73     CCACHE_DIR: ${CIRRUS_WORKING_DIR}/ccache_dir
74     # no options enabled, should be small
75     CCACHE_MAXSIZE: "150M"
77   # Container starts up quickly, but is slower at runtime, particularly for
78   # tests. Good for the briefly running sanity check.
79   container:
80     image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest
81     cpu: $CPUS
83   ccache_cache:
84     folder: $CCACHE_DIR
86   create_user_script: |
87     useradd -m postgres
88     chown -R postgres:postgres .
89     mkdir -p ${CCACHE_DIR}
90     chown -R postgres:postgres ${CCACHE_DIR}
91     echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
92     su postgres -c "ulimit -l -H && ulimit -l -S"
93     # Can't change container's kernel.core_pattern. Postgres user can't write
94     # to / normally. Change that.
95     chown root:postgres /
96     chmod g+rwx /
98   configure_script: |
99     su postgres <<-EOF
100       meson setup \
101         --buildtype=debug \
102         --auto-features=disabled \
103         -Dtap_tests=enabled \
104         build
105     EOF
106   build_script: |
107     su postgres <<-EOF
108       ninja -C build -j${BUILD_JOBS}
109     EOF
110   upload_caches: ccache
112   # Run a minimal set of tests. The main regression tests take too long for
113   # this purpose. For now this is a random quick pg_regress style test, and a
114   # tap test that exercises both a frontend binary and the backend.
115   test_minimal_script: |
116     su postgres <<-EOF
117       ulimit -c unlimited
118       meson test $MTEST_ARGS --num-processes ${TEST_JOBS} \
119         tmp_install cube/regress pg_ctl/001_start_stop
120     EOF
122   on_failure:
123     <<: *on_failure_meson
124     cores_script: |
125       mkdir -m 770 /tmp/cores
126       find / -maxdepth 1 -type f -name 'core*' -exec mv '{}' /tmp/cores/ \;
127       src/tools/ci/cores_backtrace.sh linux /tmp/cores
130 task:
131   name: FreeBSD - 13 - Meson
133   env:
134     # FreeBSD on GCP is slow when running with larger number of CPUS /
135     # jobs. Using one more job than cpus seems to work best.
136     CPUS: 2
137     BUILD_JOBS: 3
138     TEST_JOBS: 3
140     CCACHE_DIR: /tmp/ccache_dir
141     CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST
142     CFLAGS: -Og -ggdb
144   depends_on: SanityCheck
145   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
147   compute_engine_instance:
148     image_project: $IMAGE_PROJECT
149     image: family/pg-ci-freebsd-13
150     platform: freebsd
151     cpu: $CPUS
152     memory: 4G
153     disk: 50
155   sysinfo_script: |
156     id
157     uname -a
158     ulimit -a -H && ulimit -a -S
159     export
161   ccache_cache:
162     folder: $CCACHE_DIR
163   # Workaround around performance issues due to 32KB block size
164   repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
165   create_user_script: |
166     pw useradd postgres
167     chown -R postgres:postgres .
168     mkdir -p ${CCACHE_DIR}
169     chown -R postgres:postgres ${CCACHE_DIR}
170   setup_core_files_script: |
171     mkdir -m 770 /tmp/cores
172     chown root:postgres /tmp/cores
173     sysctl kern.corefile='/tmp/cores/%N.%P.core'
174   setup_additional_packages_script: |
175     #pkg install -y ...
177   # NB: Intentionally build without -Dllvm. The freebsd image size is already
178   # large enough to make VM startup slow, and even without llvm freebsd
179   # already takes longer than other platforms except for windows.
180   configure_script: |
181     su postgres <<-EOF
182       meson setup \
183         --buildtype=debug \
184         -Dcassert=true -Dssl=openssl -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
185         -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
186         -Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
187         build
188     EOF
189   build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
190   upload_caches: ccache
192   test_world_script: |
193     su postgres <<-EOF
194       ulimit -c unlimited
195       meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
196     EOF
198   # test runningcheck, freebsd chosen because it's currently fast enough
199   test_running_script: |
200     su postgres <<-EOF
201       set -e
202       ulimit -c unlimited
203       meson test $MTEST_ARGS --quiet --suite setup
204       export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/pgsql/lib/:$LD_LIBRARY_PATH"
205       mkdir -p build/testrun
206       build/tmp_install/usr/local/pgsql/bin/initdb -N build/runningcheck --no-instructions -A trust
207       echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf
208       build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start
209       meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
210       build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop
211     EOF
213   on_failure:
214     <<: *on_failure_meson
215     cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
218 # configure feature flags, shared between the task running the linux tests and
219 # the CompilerWarnings task
220 LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
221   --with-gssapi
222   --with-icu
223   --with-ldap
224   --with-libxml
225   --with-libxslt
226   --with-llvm
227   --with-lz4
228   --with-pam
229   --with-perl
230   --with-python
231   --with-selinux
232   --with-ssl=openssl
233   --with-systemd
234   --with-tcl --with-tclconfig=/usr/lib/tcl8.6/
235   --with-uuid=ossp
236   --with-zstd
238 LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
239   -Dllvm=enabled
240   -Dssl=openssl
241   -Duuid=e2fs
244 task:
245   env:
246     CPUS: 4
247     BUILD_JOBS: 4
248     TEST_JOBS: 8 # experimentally derived to be a decent choice
250     CCACHE_DIR: /tmp/ccache_dir
251     DEBUGINFOD_URLS: "https://debuginfod.debian.net"
253     # Enable a reasonable set of sanitizers. Use the linux task for that, as
254     # it one of the fastest tasks (without sanitizers). Also several of the
255     # sanitizers work best on linux.
256     #
257     # The overhead of alignment sanitizer is low, undefined behaviour has
258     # moderate overhead. Test alignment sanitizer in the meson task, as it
259     # does both 32 and 64 bit builds and is thus more likely to expose
260     # alignment bugs.
261     #
262     # Address sanitizer in contrast is somewhat expensive. Enable it in the
263     # autoconf task, as the meson task tests both 32 and 64bit.
264     #
265     # disable_coredump=0, abort_on_error=1: for useful backtraces in case of crashes
266     # print_stacktraces=1,verbosity=2, duh
267     # detect_leaks=0: too many uninteresting leak errors in short-lived binaries
268     UBSAN_OPTIONS: print_stacktrace=1:disable_coredump=0:abort_on_error=1:verbosity=2
269     ASAN_OPTIONS: print_stacktrace=1:disable_coredump=0:abort_on_error=1:detect_leaks=0
271     # SANITIZER_FLAGS is set in the tasks below
272     CFLAGS: -Og -ggdb -fno-sanitize-recover=all $SANITIZER_FLAGS
273     CXXFLAGS: $CFLAGS
274     LDFLAGS: $SANITIZER_FLAGS
275     CC: ccache gcc
276     CXX: ccache g++
278     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
279     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
281   depends_on: SanityCheck
282   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
284   compute_engine_instance:
285     image_project: $IMAGE_PROJECT
286     image: family/pg-ci-bullseye
287     platform: linux
288     cpu: $CPUS
289     memory: 4G
291   ccache_cache:
292     folder: ${CCACHE_DIR}
294   sysinfo_script: |
295     id
296     uname -a
297     cat /proc/cmdline
298     ulimit -a -H && ulimit -a -S
299     export
300   create_user_script: |
301     useradd -m postgres
302     chown -R postgres:postgres .
303     mkdir -p ${CCACHE_DIR}
304     chown -R postgres:postgres ${CCACHE_DIR}
305     echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
306     su postgres -c "ulimit -l -H && ulimit -l -S"
307   setup_core_files_script: |
308     mkdir -m 770 /tmp/cores
309     chown root:postgres /tmp/cores
310     sysctl kernel.core_pattern='/tmp/cores/%e-%s-%p.core'
311   setup_additional_packages_script: |
312     #apt-get update
313     #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
315   matrix:
316     - name: Linux - Debian Bullseye - Autoconf
318       env:
319         SANITIZER_FLAGS: -fsanitize=address
321       configure_script: |
322         su postgres <<-EOF
323           ./configure \
324             --enable-cassert --enable-debug --enable-tap-tests \
325             --enable-nls \
326             --with-segsize-blocks=8 \
327             \
328             ${LINUX_CONFIGURE_FEATURES} \
329             \
330             CLANG="ccache clang"
331         EOF
332       build_script: su postgres -c "make -s -j${BUILD_JOBS} world-bin"
333       upload_caches: ccache
335       test_world_script: |
336         su postgres <<-EOF
337           ulimit -c unlimited # default is 0
338           make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
339         EOF
341       on_failure:
342         <<: *on_failure_ac
344     - name: Linux - Debian Bullseye - Meson
346       env:
347         CCACHE_MAXSIZE: "400M" # tests two different builds
348         SANITIZER_FLAGS: -fsanitize=alignment,undefined
350       configure_script: |
351         su postgres <<-EOF
352           meson setup \
353             --buildtype=debug \
354             -Dcassert=true \
355             ${LINUX_MESON_FEATURES} \
356             -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
357             build
358         EOF
360       # Also build & test in a 32bit build - it's gotten rare to test that
361       # locally.
362       configure_32_script: |
363         su postgres <<-EOF
364           export CC='ccache gcc -m32'
365           meson setup \
366             --buildtype=debug \
367             -Dcassert=true \
368             ${LINUX_MESON_FEATURES} \
369             -Dllvm=disabled \
370             --pkg-config-path /usr/lib/i386-linux-gnu/pkgconfig/ \
371             -DPERL=perl5.32-i386-linux-gnu \
372             -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
373             build-32
374         EOF
376       build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
377       build_32_script: su postgres -c 'ninja -C build-32 -j${BUILD_JOBS}'
379       upload_caches: ccache
381       test_world_script: |
382         su postgres <<-EOF
383           ulimit -c unlimited
384           meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
385         EOF
386         # so that we don't upload 64bit logs if 32bit fails
387         rm -rf build/
389       # There's currently no coverage of icu with LANG=C in the buildfarm. We
390       # can easily provide some here by running one of the sets of tests that
391       # way. Newer versions of python insist on changing the LC_CTYPE away
392       # from C, prevent that with PYTHONCOERCECLOCALE.
393       test_world_32_script: |
394         su postgres <<-EOF
395           ulimit -c unlimited
396           PYTHONCOERCECLOCALE=0 LANG=C meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS}
397         EOF
399       on_failure:
400         <<: *on_failure_meson
402   on_failure:
403     cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
406 task:
407   name: macOS - Monterey - Meson
409   env:
410     CPUS: 12 # always get that much for cirrusci macOS instances
411     BUILD_JOBS: $CPUS
412     # Test performance regresses noticably when using all cores. 8 seems to
413     # work OK. See
414     # https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de
415     TEST_JOBS: 8
417     CIRRUS_WORKING_DIR: ${HOME}/pgsql/
418     CCACHE_DIR: ${HOME}/ccache
419     HOMEBREW_CACHE: ${HOME}/homebrew-cache
420     PERL5LIB: ${HOME}/perl5/lib/perl5
422     CC: ccache cc
423     CXX: ccache c++
424     CPPFLAGS: -DRANDOMIZE_ALLOCATED_MEMORY
425     CFLAGS: -Og -ggdb
426     CXXFLAGS: -Og -ggdb
428   depends_on: SanityCheck
429   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
431   osx_instance:
432     image: monterey-base
434   sysinfo_script: |
435     id
436     uname -a
437     ulimit -a -H && ulimit -a -S
438     export
440   setup_core_files_script:
441     - mkdir ${HOME}/cores
442     - sudo sysctl kern.corefile="${HOME}/cores/core.%P"
444   perl_cache:
445     folder: ~/perl5
446   cpan_install_script:
447     - perl -mIPC::Run -e 1 || cpan -T IPC::Run
448     - perl -mIO::Pty -e 1 || cpan -T IO::Pty
449   upload_caches: perl
452   # XXX: Could we instead install homebrew into a cached directory? The
453   # homebrew installation takes a good bit of time every time, even if the
454   # packages do not need to be downloaded.
455   homebrew_cache:
456     folder: $HOMEBREW_CACHE
457   setup_additional_packages_script: |
458     brew install \
459       ccache \
460       icu4c \
461       krb5 \
462       llvm \
463       lz4 \
464       make \
465       meson \
466       openldap \
467       openssl \
468       python \
469       tcl-tk \
470       zstd
472     brew cleanup -s # to reduce cache size
473   upload_caches: homebrew
475   ccache_cache:
476     folder: $CCACHE_DIR
477   configure_script: |
478     brewpath="/usr/local"
479     PKG_CONFIG_PATH="${brewpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
481     for pkg in icu4c krb5 openldap openssl zstd ; do
482       pkgpath="${brewpath}/opt/${pkg}"
483       PKG_CONFIG_PATH="${pkgpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
484       PATH="${pkgpath}/bin:${pkgpath}/sbin:$PATH"
485     done
487     export PKG_CONFIG_PATH PATH
489     meson setup \
490       --buildtype=debug \
491       -Dextra_include_dirs=${brewpath}/include \
492       -Dextra_lib_dirs=${brewpath}/lib \
493       -Dcassert=true \
494       -Dssl=openssl -Duuid=e2fs -Ddtrace=auto \
495       -Dsegsize_blocks=6 \
496       -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
497       build
499   build_script: ninja -C build -j${BUILD_JOBS}
500   upload_caches: ccache
502   test_world_script: |
503     ulimit -c unlimited # default is 0
504     ulimit -n 1024 # default is 256, pretty low
505     meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
507   on_failure:
508     <<: *on_failure_meson
509     cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
512 WINDOWS_ENVIRONMENT_BASE: &WINDOWS_ENVIRONMENT_BASE
513   env:
514     # Half the allowed per-user CPU cores
515     CPUS: 4
517     # The default cirrus working dir is in a directory msbuild complains about
518     CIRRUS_WORKING_DIR: "c:/cirrus"
519     # git's tar doesn't deal with drive letters, see
520     # https://postgr.es/m/b6782dc3-a7b0-ed56-175f-f8f54cb08d67%40dunslane.net
521     TAR: "c:/windows/system32/tar.exe"
522     # Avoids port conflicts between concurrent tap test runs
523     PG_TEST_USE_UNIX_SOCKETS: 1
524     PG_REGRESS_SOCK_DIR: "c:/cirrus/"
526   sysinfo_script: |
527     chcp
528     systeminfo
529     powershell -Command get-psdrive -psprovider filesystem
530     set
533 task:
534   name: Windows - Server 2019, VS 2019 - Meson & ninja
535   << : *WINDOWS_ENVIRONMENT_BASE
537   env:
538     TEST_JOBS: 8 # wild guess, data based value welcome
540     # Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That
541     # prevents crash reporting from working unless binaries do SetErrorMode()
542     # themselves. Furthermore, it appears that either python or, more likely,
543     # the C runtime has a bug where SEM_NOGPFAULTERRORBOX can very
544     # occasionally *trigger* a crash on process exit - which is hard to debug,
545     # given that it explicitly prevents crash dumps from working...
546     # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
547     CIRRUS_WINDOWS_ERROR_MODE: 0x8001
549   depends_on: SanityCheck
550   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
552   windows_container:
553     image: $CONTAINER_REPO/windows_ci_vs_2019:latest
554     cpu: $CPUS
555     memory: 4G
557   setup_additional_packages_script: |
558     REM choco install -y --no-progress ...
560   # Use /DEBUG:FASTLINK to avoid high memory usage during linking
561   configure_script: |
562     vcvarsall x64
563     meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
565   build_script: |
566     vcvarsall x64
567     ninja -C build
569   check_world_script: |
570     vcvarsall x64
571     meson test %MTEST_ARGS% --num-processes %TEST_JOBS%
573   on_failure:
574     <<: *on_failure_meson
575     crashlog_artifacts:
576       path: "crashlog-*.txt"
577       type: text/plain
580 task:
581   << : *WINDOWS_ENVIRONMENT_BASE
582   name: Windows - Server 2019, MinGW64 - Meson
584   # due to resource constraints we don't run this task by default for now
585   trigger_type: manual
586   # worth using only_if despite being manual, otherwise this task will show up
587   # when e.g. ci-os-only: linux is used.
588   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*mingw.*'
589   # otherwise it'll be sorted before other tasks
590   depends_on: SanityCheck
592   windows_container:
593     image: $CONTAINER_REPO/windows_ci_mingw64:latest
594     cpu: $CPUS
595     memory: 4G
597   env:
598     TEST_JOBS: 4 # higher concurrency causes occasional failures
599     CCACHE_DIR: C:/msys64/ccache
600     CCACHE_MAXSIZE: "500M"
601     CCACHE_SLOPPINESS: pch_defines,time_macros
602     CCACHE_DEPEND: 1
603     # for some reason mingw plpython cannot find it's installation without this
604     PYTHONHOME: C:/msys64/ucrt64
605     # prevents MSYS bash from resetting error mode
606     MSYS: winjitdebug
607     # Start bash in current working directory
608     CHERE_INVOKING: 1
609     BASH: C:\msys64\usr\bin\bash.exe -l
611   ccache_cache:
612     folder: ${CCACHE_DIR}
614   setup_additional_packages_script: |
615     REM C:\msys64\usr\bin\pacman.exe -S --noconfirm ...
617   mingw_info_script: |
618     %BASH% -c "where gcc"
619     %BASH% -c "gcc --version"
620     %BASH% -c "where perl"
621     %BASH% -c "perl --version"
623   # disable -Dnls as the number of files it creates cause a noticable slowdown
624   configure_script: |
625     %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build"
627   build_script: |
628     %BASH% -c "ninja -C build"
630   upload_caches: ccache
632   test_world_script: |
633     %BASH% -c "meson test %MTEST_ARGS% --num-processes %TEST_JOBS%"
635   on_failure:
636     <<: *on_failure_meson
637     crashlog_artifacts:
638       path: "crashlog-*.txt"
639       type: text/plain
642 task:
643   name: CompilerWarnings
645   # To limit unnecessary work only run this once the SanityCheck
646   # succeeds. This is particularly important for this task as we intentionally
647   # use always: to continue after failures. Task that did not run count as a
648   # success, so we need to recheck SanityChecks's condition here ...
649   depends_on: SanityCheck
650   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*'
652   env:
653     CPUS: 4
654     BUILD_JOBS: 4
656     # Use larger ccache cache, as this task compiles with multiple compilers /
657     # flag combinations
658     CCACHE_MAXSIZE: "1GB"
659     CCACHE_DIR: "/tmp/ccache_dir"
661     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
662     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
664   container:
665     image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest
666     cpu: $CPUS
668   sysinfo_script: |
669     id
670     uname -a
671     cat /proc/cmdline
672     ulimit -a -H && ulimit -a -S
673     gcc -v
674     clang -v
675     export
677   ccache_cache:
678     folder: $CCACHE_DIR
680   setup_additional_packages_script: |
681     #apt-get update
682     #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
684   ###
685   # Test that code can be built with gcc/clang without warnings
686   ###
688   setup_script: echo "COPT=-Werror" > src/Makefile.custom
690   # Trace probes have a history of getting accidentally broken. Use the
691   # different compilers to build with different combinations of dtrace on/off
692   # and cassert on/off.
694   # gcc, cassert off, dtrace on
695   always:
696     gcc_warning_script: |
697       time ./configure \
698         --cache gcc.cache \
699         --enable-dtrace \
700         ${LINUX_CONFIGURE_FEATURES} \
701         CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
702       make -s -j${BUILD_JOBS} clean
703       time make -s -j${BUILD_JOBS} world-bin
705   # gcc, cassert on, dtrace off
706   always:
707     gcc_a_warning_script: |
708       time ./configure \
709         --cache gcc.cache \
710         --enable-cassert \
711         ${LINUX_CONFIGURE_FEATURES} \
712         CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
713       make -s -j${BUILD_JOBS} clean
714       time make -s -j${BUILD_JOBS} world-bin
716   # clang, cassert off, dtrace off
717   always:
718     clang_warning_script: |
719       time ./configure \
720         --cache clang.cache \
721         ${LINUX_CONFIGURE_FEATURES} \
722         CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
723       make -s -j${BUILD_JOBS} clean
724       time make -s -j${BUILD_JOBS} world-bin
726   # clang, cassert on, dtrace on
727   always:
728     clang_a_warning_script: |
729       time ./configure \
730         --cache clang.cache \
731         --enable-cassert \
732         --enable-dtrace \
733         ${LINUX_CONFIGURE_FEATURES} \
734         CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
735       make -s -j${BUILD_JOBS} clean
736       time make -s -j${BUILD_JOBS} world-bin
738   # cross-compile to windows
739   always:
740     mingw_cross_warning_script: |
741       time ./configure \
742         --host=x86_64-w64-mingw32 \
743         --enable-cassert \
744         CC="ccache x86_64-w64-mingw32-gcc" \
745         CXX="ccache x86_64-w64-mingw32-g++"
746       make -s -j${BUILD_JOBS} clean
747       time make -s -j${BUILD_JOBS} world-bin
749   ###
750   # Verify docs can be built
751   ###
752   # XXX: Only do this if there have been changes in doc/ since last build
753   always:
754     docs_build_script: |
755       time ./configure \
756         --cache gcc.cache \
757         CC="ccache gcc" \
758         CXX="ccache g++" \
759         CLANG="ccache clang"
760       make -s -j${BUILD_JOBS} clean
761       time make -s -j${BUILD_JOBS} -C doc
763   ###
764   # Verify headerscheck / cpluspluscheck succeed
765   #
766   # - Don't use ccache, the files are uncacheable, polluting ccache's
767   #   cache
768   # - Use -fmax-errors, as particularly cpluspluscheck can be very verbose
769   # - XXX have to disable ICU to avoid errors:
770   #   https://postgr.es/m/20220323002024.f2g6tivduzrktgfa%40alap3.anarazel.de
771   ###
772   always:
773     headers_headerscheck_script: |
774       time ./configure \
775         ${LINUX_CONFIGURE_FEATURES} \
776         --without-icu \
777         --quiet \
778         CC="gcc" CXX"=g++" CLANG="clang"
779       make -s -j${BUILD_JOBS} clean
780       time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
781     headers_cpluspluscheck_script: |
782       time make -s cpluspluscheck EXTRAFLAGS='-fmax-errors=10'
784   always:
785     upload_caches: ccache