README: remove duplicate download link & mention related softw.
[pgsql.git] / .cirrus.tasks.yml
blobe137769850dfb77106492ee7b5849fe686b617c9
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   # The lower depth accelerates git clone. Use a bit of depth so that
9   # concurrent tasks and retrying older jobs have a chance of working.
10   CIRRUS_CLONE_DEPTH: 500
11   # Useful to be able to analyse what in a script takes long
12   CIRRUS_LOG_TIMESTAMP: true
14   CCACHE_MAXSIZE: "250M"
16   # target to test, for all but windows
17   CHECK: check-world PROVE_FLAGS=$PROVE_FLAGS
18   CHECKFLAGS: -Otarget
19   PROVE_FLAGS: --timer
20   MTEST_ARGS: --print-errorlogs --no-rebuild -C build
21   PGCTLTIMEOUT: 120 # avoids spurious failures during parallel tests
22   TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
23   PG_TEST_EXTRA: kerberos ldap ssl load_balance
26 # What files to preserve in case tests fail
27 on_failure_ac: &on_failure_ac
28   log_artifacts:
29     paths:
30       - "**/*.log"
31       - "**/*.diffs"
32       - "**/regress_log_*"
33     type: text/plain
35 on_failure_meson: &on_failure_meson
36   testrun_artifacts:
37     paths:
38       - "build*/testrun/**/*.log"
39       - "build*/testrun/**/*.diffs"
40       - "build*/testrun/**/regress_log_*"
41     type: text/plain
43   # In theory it'd be nice to upload the junit files meson generates, so that
44   # cirrus will nicely annotate the commit. Unfortunately the files don't
45   # contain identifiable file + line numbers right now, so the annotations
46   # don't end up useful. We could probably improve on that with a some custom
47   # conversion script, but ...
48   meson_log_artifacts:
49     path: "build*/meson-logs/*.txt"
50     type: text/plain
53 # To avoid unnecessarily spinning up a lot of VMs / containers for entirely
54 # broken commits, have a minimal task that all others depend on.
55 task:
56   name: SanityCheck
58   # If a specific OS is requested, don't run the sanity check. This shortens
59   # push-wait-for-ci cycle time a bit when debugging operating system specific
60   # failures. Uses skip instead of only_if, as cirrus otherwise warns about
61   # only_if conditions not matching.
62   skip: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*'
64   env:
65     CPUS: 4
66     BUILD_JOBS: 8
67     TEST_JOBS: 8
68     IMAGE_FAMILY: pg-ci-bullseye
69     CCACHE_DIR: ${CIRRUS_WORKING_DIR}/ccache_dir
70     # no options enabled, should be small
71     CCACHE_MAXSIZE: "150M"
73   # While containers would start up a bit quicker, building is a bit
74   # slower. This way we don't have to maintain a container image.
75   <<: *linux_task_template
77   ccache_cache:
78     folder: $CCACHE_DIR
80   create_user_script: |
81     useradd -m postgres
82     chown -R postgres:postgres .
83     mkdir -p ${CCACHE_DIR}
84     chown -R postgres:postgres ${CCACHE_DIR}
85     echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
86     su postgres -c "ulimit -l -H && ulimit -l -S"
87     # Can't change container's kernel.core_pattern. Postgres user can't write
88     # to / normally. Change that.
89     chown root:postgres /
90     chmod g+rwx /
92   configure_script: |
93     su postgres <<-EOF
94       meson setup \
95         --buildtype=debug \
96         --auto-features=disabled \
97         -Dtap_tests=enabled \
98         build
99     EOF
100   build_script: |
101     su postgres <<-EOF
102       ninja -C build -j${BUILD_JOBS}
103     EOF
104   upload_caches: ccache
106   # Run a minimal set of tests. The main regression tests take too long for
107   # this purpose. For now this is a random quick pg_regress style test, and a
108   # tap test that exercises both a frontend binary and the backend.
109   test_minimal_script: |
110     su postgres <<-EOF
111       ulimit -c unlimited
112       meson test $MTEST_ARGS --suite setup
113       meson test $MTEST_ARGS --num-processes ${TEST_JOBS} \
114         cube/regress pg_ctl/001_start_stop
115     EOF
117   on_failure:
118     <<: *on_failure_meson
119     cores_script: |
120       mkdir -m 770 /tmp/cores
121       find / -maxdepth 1 -type f -name 'core*' -exec mv '{}' /tmp/cores/ \;
122       src/tools/ci/cores_backtrace.sh linux /tmp/cores
125 task:
126   name: FreeBSD - 13 - Meson
128   env:
129     # FreeBSD on GCP is slow when running with larger number of CPUS /
130     # jobs. Using one more job than cpus seems to work best.
131     CPUS: 2
132     BUILD_JOBS: 3
133     TEST_JOBS: 3
134     IMAGE_FAMILY: pg-ci-freebsd-13
135     DISK_SIZE: 50
137     CCACHE_DIR: /tmp/ccache_dir
138     CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS
139     CFLAGS: -Og -ggdb
141   <<: *freebsd_task_template
143   depends_on: SanityCheck
144   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
146   sysinfo_script: |
147     id
148     uname -a
149     ulimit -a -H && ulimit -a -S
150     export
152   ccache_cache:
153     folder: $CCACHE_DIR
154   # Work around performance issues due to 32KB block size
155   repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
156   create_user_script: |
157     pw useradd postgres
158     chown -R postgres:postgres .
159     mkdir -p ${CCACHE_DIR}
160     chown -R postgres:postgres ${CCACHE_DIR}
161   setup_core_files_script: |
162     mkdir -m 770 /tmp/cores
163     chown root:postgres /tmp/cores
164     sysctl kern.corefile='/tmp/cores/%N.%P.core'
165   setup_additional_packages_script: |
166     #pkg install -y ...
168   # NB: Intentionally build without -Dllvm. The freebsd image size is already
169   # large enough to make VM startup slow, and even without llvm freebsd
170   # already takes longer than other platforms except for windows.
171   configure_script: |
172     su postgres <<-EOF
173       meson setup \
174         --buildtype=debug \
175         -Dcassert=true -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
176         -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
177         -Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
178         build
179     EOF
180   build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
181   upload_caches: ccache
183   test_world_script: |
184     su postgres <<-EOF
185       ulimit -c unlimited
186       meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
187     EOF
189   # test runningcheck, freebsd chosen because it's currently fast enough
190   test_running_script: |
191     su postgres <<-EOF
192       set -e
193       ulimit -c unlimited
194       meson test $MTEST_ARGS --quiet --suite setup
195       export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/pgsql/lib/:$LD_LIBRARY_PATH"
196       mkdir -p build/testrun
197       build/tmp_install/usr/local/pgsql/bin/initdb -N build/runningcheck --no-instructions -A trust
198       echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf
199       build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start
200       meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
201       build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop
202     EOF
204   on_failure:
205     # if the server continues running, it often causes cirrus-ci to fail
206     # during upload, as it doesn't expect artifacts to change size
207     stop_running_script: |
208       su postgres <<-EOF
209         build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true
210       EOF
211     <<: *on_failure_meson
212     cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
215 # configure feature flags, shared between the task running the linux tests and
216 # the CompilerWarnings task
217 LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
218   --with-gssapi
219   --with-icu
220   --with-ldap
221   --with-libxml
222   --with-libxslt
223   --with-llvm
224   --with-lz4
225   --with-pam
226   --with-perl
227   --with-python
228   --with-selinux
229   --with-ssl=openssl
230   --with-systemd
231   --with-tcl --with-tclconfig=/usr/lib/tcl8.6/
232   --with-uuid=ossp
233   --with-zstd
235 LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
236   -Dllvm=enabled
237   -Duuid=e2fs
240 task:
241   env:
242     CPUS: 4
243     BUILD_JOBS: 4
244     TEST_JOBS: 8 # experimentally derived to be a decent choice
245     IMAGE_FAMILY: pg-ci-bullseye
247     CCACHE_DIR: /tmp/ccache_dir
248     DEBUGINFOD_URLS: "https://debuginfod.debian.net"
250     # Enable a reasonable set of sanitizers. Use the linux task for that, as
251     # it's one of the fastest tasks (without sanitizers). Also several of the
252     # sanitizers work best on linux.
253     #
254     # The overhead of alignment sanitizer is low, undefined behaviour has
255     # moderate overhead. Test alignment sanitizer in the meson task, as it
256     # does both 32 and 64 bit builds and is thus more likely to expose
257     # alignment bugs.
258     #
259     # Address sanitizer in contrast is somewhat expensive. Enable it in the
260     # autoconf task, as the meson task tests both 32 and 64bit.
261     #
262     # disable_coredump=0, abort_on_error=1: for useful backtraces in case of crashes
263     # print_stacktraces=1,verbosity=2, duh
264     # detect_leaks=0: too many uninteresting leak errors in short-lived binaries
265     UBSAN_OPTIONS: print_stacktrace=1:disable_coredump=0:abort_on_error=1:verbosity=2
266     ASAN_OPTIONS: print_stacktrace=1:disable_coredump=0:abort_on_error=1:detect_leaks=0
268     # SANITIZER_FLAGS is set in the tasks below
269     CFLAGS: -Og -ggdb -fno-sanitize-recover=all $SANITIZER_FLAGS
270     CXXFLAGS: $CFLAGS
271     LDFLAGS: $SANITIZER_FLAGS
272     CC: ccache gcc
273     CXX: ccache g++
275     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
276     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
278   <<: *linux_task_template
280   depends_on: SanityCheck
281   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
283   ccache_cache:
284     folder: ${CCACHE_DIR}
286   sysinfo_script: |
287     id
288     uname -a
289     cat /proc/cmdline
290     ulimit -a -H && ulimit -a -S
291     export
292   create_user_script: |
293     useradd -m postgres
294     chown -R postgres:postgres .
295     mkdir -p ${CCACHE_DIR}
296     chown -R postgres:postgres ${CCACHE_DIR}
297     echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
298     su postgres -c "ulimit -l -H && ulimit -l -S"
299   setup_core_files_script: |
300     mkdir -m 770 /tmp/cores
301     chown root:postgres /tmp/cores
302     sysctl kernel.core_pattern='/tmp/cores/%e-%s-%p.core'
304   setup_hosts_file_script: |
305     cat >> /etc/hosts <<-EOF
306       127.0.0.1 pg-loadbalancetest
307       127.0.0.2 pg-loadbalancetest
308       127.0.0.3 pg-loadbalancetest
309     EOF
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       # Normally, the "relation segment" code basically has no coverage in our
322       # tests, because we (quite reasonably) don't generate tables large
323       # enough in tests. We've had plenty bugs that we didn't notice due the
324       # code not being exercised much. Thus specify a very small segment size
325       # here. Use a non-power-of-two segment size, given we currently allow
326       # that.
327       configure_script: |
328         su postgres <<-EOF
329           ./configure \
330             --enable-cassert --enable-debug --enable-tap-tests \
331             --enable-nls \
332             --with-segsize-blocks=6 \
333             \
334             ${LINUX_CONFIGURE_FEATURES} \
335             \
336             CLANG="ccache clang"
337         EOF
338       build_script: su postgres -c "make -s -j${BUILD_JOBS} world-bin"
339       upload_caches: ccache
341       test_world_script: |
342         su postgres <<-EOF
343           ulimit -c unlimited # default is 0
344           make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
345         EOF
347       on_failure:
348         <<: *on_failure_ac
350     - name: Linux - Debian Bullseye - Meson
352       env:
353         CCACHE_MAXSIZE: "400M" # tests two different builds
354         SANITIZER_FLAGS: -fsanitize=alignment,undefined
356       configure_script: |
357         su postgres <<-EOF
358           meson setup \
359             --buildtype=debug \
360             -Dcassert=true \
361             ${LINUX_MESON_FEATURES} \
362             -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
363             build
364         EOF
366       # Also build & test in a 32bit build - it's gotten rare to test that
367       # locally.
368       configure_32_script: |
369         su postgres <<-EOF
370           export CC='ccache gcc -m32'
371           meson setup \
372             --buildtype=debug \
373             -Dcassert=true \
374             ${LINUX_MESON_FEATURES} \
375             -Dllvm=disabled \
376             --pkg-config-path /usr/lib/i386-linux-gnu/pkgconfig/ \
377             -DPERL=perl5.32-i386-linux-gnu \
378             -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
379             build-32
380         EOF
382       build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
383       build_32_script: su postgres -c 'ninja -C build-32 -j${BUILD_JOBS}'
385       upload_caches: ccache
387       test_world_script: |
388         su postgres <<-EOF
389           ulimit -c unlimited
390           meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
391         EOF
392         # so that we don't upload 64bit logs if 32bit fails
393         rm -rf build/
395       # There's currently no coverage of icu with LANG=C in the buildfarm. We
396       # can easily provide some here by running one of the sets of tests that
397       # way. Newer versions of python insist on changing the LC_CTYPE away
398       # from C, prevent that with PYTHONCOERCECLOCALE.
399       test_world_32_script: |
400         su postgres <<-EOF
401           ulimit -c unlimited
402           PYTHONCOERCECLOCALE=0 LANG=C meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS}
403         EOF
405       on_failure:
406         <<: *on_failure_meson
408   on_failure:
409     cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
412 task:
413   name: macOS - Ventura - Meson
415   env:
416     CPUS: 4 # always get that much for cirrusci macOS instances
417     BUILD_JOBS: $CPUS
418     # Test performance regresses noticably when using all cores. 8 seems to
419     # work OK. See
420     # https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de
421     TEST_JOBS: 8
422     IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest
424     CIRRUS_WORKING_DIR: ${HOME}/pgsql/
425     CCACHE_DIR: ${HOME}/ccache
426     MACPORTS_CACHE: ${HOME}/macports-cache
428     CC: ccache cc
429     CXX: ccache c++
430     CFLAGS: -Og -ggdb
431     CXXFLAGS: -Og -ggdb
433   <<: *macos_task_template
435   depends_on: SanityCheck
436   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
438   sysinfo_script: |
439     id
440     uname -a
441     ulimit -a -H && ulimit -a -S
442     export
444   setup_core_files_script:
445     - mkdir ${HOME}/cores
446     - sudo sysctl kern.corefile="${HOME}/cores/core.%P"
448   # Use macports, even though homebrew is installed. The installation
449   # of the additional packages we need would take quite a while with
450   # homebrew, even if we cache the downloads. We can't cache all of
451   # homebrew, because it's already large. So we use macports. To cache
452   # the installation we create a .dmg file that we mount if it already
453   # exists.
454   # XXX: The reason for the direct p5.34* references is that we'd need
455   # the large macport tree around to figure out that p5-io-tty is
456   # actually p5.34-io-tty. Using the unversioned name works, but
457   # updates macports every time.
458   macports_cache:
459     folder: ${MACPORTS_CACHE}
460   setup_additional_packages_script: |
461     sh src/tools/ci/ci_macports_packages.sh \
462       ccache \
463       icu \
464       kerberos5 \
465       lz4 \
466       meson \
467       openldap \
468       openssl \
469       p5.34-io-tty \
470       p5.34-ipc-run \
471       tcl \
472       zstd
473     # Make macports install visible for subsequent steps
474     echo PATH=/opt/local/sbin/:/opt/local/bin/:$PATH >> $CIRRUS_ENV
475   upload_caches: macports
477   ccache_cache:
478     folder: $CCACHE_DIR
479   configure_script: |
480     export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig/"
481     meson setup \
482       --buildtype=debug \
483       -Dextra_include_dirs=/opt/local/include \
484       -Dextra_lib_dirs=/opt/local/lib \
485       -Dcassert=true \
486       -Duuid=e2fs -Ddtrace=auto \
487       -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
488       build
490   build_script: ninja -C build -j${BUILD_JOBS}
491   upload_caches: ccache
493   test_world_script: |
494     ulimit -c unlimited # default is 0
495     ulimit -n 1024 # default is 256, pretty low
496     meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
498   on_failure:
499     <<: *on_failure_meson
500     cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
503 WINDOWS_ENVIRONMENT_BASE: &WINDOWS_ENVIRONMENT_BASE
504   env:
505     # Half the allowed per-user CPU cores
506     CPUS: 4
508     # The default cirrus working dir is in a directory msbuild complains about
509     CIRRUS_WORKING_DIR: "c:/cirrus"
510     # git's tar doesn't deal with drive letters, see
511     # https://postgr.es/m/b6782dc3-a7b0-ed56-175f-f8f54cb08d67%40dunslane.net
512     TAR: "c:/windows/system32/tar.exe"
513     # Avoids port conflicts between concurrent tap test runs
514     PG_TEST_USE_UNIX_SOCKETS: 1
515     PG_REGRESS_SOCK_DIR: "c:/cirrus/"
516     DISK_SIZE: 50
518   sysinfo_script: |
519     chcp
520     systeminfo
521     powershell -Command get-psdrive -psprovider filesystem
522     set
525 task:
526   name: Windows - Server 2019, VS 2019 - Meson & ninja
527   << : *WINDOWS_ENVIRONMENT_BASE
529   env:
530     TEST_JOBS: 8 # wild guess, data based value welcome
532     # Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That
533     # prevents crash reporting from working unless binaries do SetErrorMode()
534     # themselves. Furthermore, it appears that either python or, more likely,
535     # the C runtime has a bug where SEM_NOGPFAULTERRORBOX can very
536     # occasionally *trigger* a crash on process exit - which is hard to debug,
537     # given that it explicitly prevents crash dumps from working...
538     # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
539     CIRRUS_WINDOWS_ERROR_MODE: 0x8001
540     IMAGE_FAMILY: pg-ci-windows-ci-vs-2019
542   <<: *windows_task_template
544   depends_on: SanityCheck
545   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
547   setup_additional_packages_script: |
548     REM choco install -y --no-progress ...
550   setup_hosts_file_script: |
551     echo 127.0.0.1 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
552     echo 127.0.0.2 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
553     echo 127.0.0.3 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
554     type c:\Windows\System32\Drivers\etc\hosts
556   # Use /DEBUG:FASTLINK to avoid high memory usage during linking
557   configure_script: |
558     vcvarsall x64
559     meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -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
561   build_script: |
562     vcvarsall x64
563     ninja -C build
565   check_world_script: |
566     vcvarsall x64
567     meson test %MTEST_ARGS% --num-processes %TEST_JOBS%
569   on_failure:
570     <<: *on_failure_meson
571     crashlog_artifacts:
572       path: "crashlog-*.txt"
573       type: text/plain
576 task:
577   << : *WINDOWS_ENVIRONMENT_BASE
578   name: Windows - Server 2019, MinGW64 - Meson
580   # due to resource constraints we don't run this task by default for now
581   trigger_type: manual
582   # worth using only_if despite being manual, otherwise this task will show up
583   # when e.g. ci-os-only: linux is used.
584   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*mingw.*'
585   # otherwise it'll be sorted before other tasks
586   depends_on: SanityCheck
588   env:
589     TEST_JOBS: 4 # higher concurrency causes occasional failures
590     CCACHE_DIR: C:/msys64/ccache
591     CCACHE_MAXSIZE: "500M"
592     CCACHE_SLOPPINESS: pch_defines,time_macros
593     CCACHE_DEPEND: 1
594     # for some reason mingw plpython cannot find its installation without this
595     PYTHONHOME: C:/msys64/ucrt64
596     # prevents MSYS bash from resetting error mode
597     MSYS: winjitdebug
598     # Start bash in current working directory
599     CHERE_INVOKING: 1
600     BASH: C:\msys64\usr\bin\bash.exe -l
601     IMAGE_FAMILY: pg-ci-windows-ci-mingw64
603   <<: *windows_task_template
605   ccache_cache:
606     folder: ${CCACHE_DIR}
608   setup_additional_packages_script: |
609     REM C:\msys64\usr\bin\pacman.exe -S --noconfirm ...
611   mingw_info_script: |
612     %BASH% -c "where gcc"
613     %BASH% -c "gcc --version"
614     %BASH% -c "where perl"
615     %BASH% -c "perl --version"
617   # disable -Dnls as the number of files it creates cause a noticable slowdown
618   configure_script: |
619     %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build"
621   build_script: |
622     %BASH% -c "ninja -C build"
624   upload_caches: ccache
626   test_world_script: |
627     %BASH% -c "meson test %MTEST_ARGS% --num-processes %TEST_JOBS%"
629   on_failure:
630     <<: *on_failure_meson
631     crashlog_artifacts:
632       path: "crashlog-*.txt"
633       type: text/plain
636 task:
637   name: CompilerWarnings
639   # To limit unnecessary work only run this once the SanityCheck
640   # succeeds. This is particularly important for this task as we intentionally
641   # use always: to continue after failures. Task that did not run count as a
642   # success, so we need to recheck SanityChecks's condition here ...
643   depends_on: SanityCheck
644   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*'
646   env:
647     CPUS: 4
648     BUILD_JOBS: 4
649     IMAGE_FAMILY: pg-ci-bullseye
651     # Use larger ccache cache, as this task compiles with multiple compilers /
652     # flag combinations
653     CCACHE_MAXSIZE: "1G"
654     CCACHE_DIR: "/tmp/ccache_dir"
656     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
657     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
659   <<: *linux_task_template
661   sysinfo_script: |
662     id
663     uname -a
664     cat /proc/cmdline
665     ulimit -a -H && ulimit -a -S
666     gcc -v
667     clang -v
668     export
670   ccache_cache:
671     folder: $CCACHE_DIR
673   setup_additional_packages_script: |
674     #apt-get update
675     #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
677   ###
678   # Test that code can be built with gcc/clang without warnings
679   ###
681   setup_script: echo "COPT=-Werror" > src/Makefile.custom
683   # Trace probes have a history of getting accidentally broken. Use the
684   # different compilers to build with different combinations of dtrace on/off
685   # and cassert on/off.
687   # gcc, cassert off, dtrace on
688   always:
689     gcc_warning_script: |
690       time ./configure \
691         --cache gcc.cache \
692         --enable-dtrace \
693         ${LINUX_CONFIGURE_FEATURES} \
694         CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
695       make -s -j${BUILD_JOBS} clean
696       time make -s -j${BUILD_JOBS} world-bin
698   # gcc, cassert on, dtrace off
699   always:
700     gcc_a_warning_script: |
701       time ./configure \
702         --cache gcc.cache \
703         --enable-cassert \
704         ${LINUX_CONFIGURE_FEATURES} \
705         CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
706       make -s -j${BUILD_JOBS} clean
707       time make -s -j${BUILD_JOBS} world-bin
709   # clang, cassert off, dtrace off
710   always:
711     clang_warning_script: |
712       time ./configure \
713         --cache clang.cache \
714         ${LINUX_CONFIGURE_FEATURES} \
715         CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
716       make -s -j${BUILD_JOBS} clean
717       time make -s -j${BUILD_JOBS} world-bin
719   # clang, cassert on, dtrace on
720   always:
721     clang_a_warning_script: |
722       time ./configure \
723         --cache clang.cache \
724         --enable-cassert \
725         --enable-dtrace \
726         ${LINUX_CONFIGURE_FEATURES} \
727         CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
728       make -s -j${BUILD_JOBS} clean
729       time make -s -j${BUILD_JOBS} world-bin
731   # cross-compile to windows
732   always:
733     mingw_cross_warning_script: |
734       time ./configure \
735         --host=x86_64-w64-mingw32 \
736         --enable-cassert \
737         --without-icu \
738         CC="ccache x86_64-w64-mingw32-gcc" \
739         CXX="ccache x86_64-w64-mingw32-g++"
740       make -s -j${BUILD_JOBS} clean
741       time make -s -j${BUILD_JOBS} world-bin
743   ###
744   # Verify docs can be built
745   ###
746   # XXX: Only do this if there have been changes in doc/ since last build
747   always:
748     docs_build_script: |
749       time ./configure \
750         --cache gcc.cache \
751         CC="ccache gcc" \
752         CXX="ccache g++" \
753         CLANG="ccache clang"
754       make -s -j${BUILD_JOBS} clean
755       time make -s -j${BUILD_JOBS} -C doc
757   ###
758   # Verify headerscheck / cpluspluscheck succeed
759   #
760   # - Don't use ccache, the files are uncacheable, polluting ccache's
761   #   cache
762   # - Use -fmax-errors, as particularly cpluspluscheck can be very verbose
763   # - XXX have to disable ICU to avoid errors:
764   #   https://postgr.es/m/20220323002024.f2g6tivduzrktgfa%40alap3.anarazel.de
765   ###
766   always:
767     headers_headerscheck_script: |
768       time ./configure \
769         ${LINUX_CONFIGURE_FEATURES} \
770         --without-icu \
771         --quiet \
772         CC="gcc" CXX"=g++" CLANG="clang"
773       make -s -j${BUILD_JOBS} clean
774       time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
775     headers_cpluspluscheck_script: |
776       time make -s cpluspluscheck EXTRAFLAGS='-fmax-errors=10'
778   always:
779     upload_caches: ccache