Stamp 16.3.
[pgsql.git] / .cirrus.tasks.yml
blob82261eccb85c864165987a7a1fb1e6075f85da68
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 --num-processes ${TEST_JOBS} \
113         tmp_install cube/regress pg_ctl/001_start_stop
114     EOF
116   on_failure:
117     <<: *on_failure_meson
118     cores_script: |
119       mkdir -m 770 /tmp/cores
120       find / -maxdepth 1 -type f -name 'core*' -exec mv '{}' /tmp/cores/ \;
121       src/tools/ci/cores_backtrace.sh linux /tmp/cores
124 task:
125   name: FreeBSD - 13 - Meson
127   env:
128     # FreeBSD on GCP is slow when running with larger number of CPUS /
129     # jobs. Using one more job than cpus seems to work best.
130     CPUS: 2
131     BUILD_JOBS: 3
132     TEST_JOBS: 3
133     IMAGE_FAMILY: pg-ci-freebsd-13
134     DISK_SIZE: 50
136     CCACHE_DIR: /tmp/ccache_dir
137     CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST
138     CFLAGS: -Og -ggdb
140   <<: *freebsd_task_template
142   depends_on: SanityCheck
143   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
145   sysinfo_script: |
146     id
147     uname -a
148     ulimit -a -H && ulimit -a -S
149     export
151   ccache_cache:
152     folder: $CCACHE_DIR
153   # Work around performance issues due to 32KB block size
154   repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
155   create_user_script: |
156     pw useradd postgres
157     chown -R postgres:postgres .
158     mkdir -p ${CCACHE_DIR}
159     chown -R postgres:postgres ${CCACHE_DIR}
160   setup_core_files_script: |
161     mkdir -m 770 /tmp/cores
162     chown root:postgres /tmp/cores
163     sysctl kern.corefile='/tmp/cores/%N.%P.core'
164   setup_additional_packages_script: |
165     #pkg install -y ...
167   # NB: Intentionally build without -Dllvm. The freebsd image size is already
168   # large enough to make VM startup slow, and even without llvm freebsd
169   # already takes longer than other platforms except for windows.
170   configure_script: |
171     su postgres <<-EOF
172       meson setup \
173         --buildtype=debug \
174         -Dcassert=true -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
175         -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
176         -Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
177         build
178     EOF
179   build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
180   upload_caches: ccache
182   test_world_script: |
183     su postgres <<-EOF
184       ulimit -c unlimited
185       meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
186     EOF
188   # test runningcheck, freebsd chosen because it's currently fast enough
189   test_running_script: |
190     su postgres <<-EOF
191       set -e
192       ulimit -c unlimited
193       meson test $MTEST_ARGS --quiet --suite setup
194       export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/pgsql/lib/:$LD_LIBRARY_PATH"
195       mkdir -p build/testrun
196       build/tmp_install/usr/local/pgsql/bin/initdb -N build/runningcheck --no-instructions -A trust
197       echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf
198       build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start
199       meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
200       build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop
201     EOF
203   on_failure:
204     # if the server continues running, it often causes cirrus-ci to fail
205     # during upload, as it doesn't expect artifacts to change size
206     stop_running_script: |
207       su postgres <<-EOF
208         build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true
209       EOF
210     <<: *on_failure_meson
211     cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
214 # configure feature flags, shared between the task running the linux tests and
215 # the CompilerWarnings task
216 LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
217   --with-gssapi
218   --with-icu
219   --with-ldap
220   --with-libxml
221   --with-libxslt
222   --with-llvm
223   --with-lz4
224   --with-pam
225   --with-perl
226   --with-python
227   --with-selinux
228   --with-ssl=openssl
229   --with-systemd
230   --with-tcl --with-tclconfig=/usr/lib/tcl8.6/
231   --with-uuid=ossp
232   --with-zstd
234 LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
235   -Dllvm=enabled
236   -Duuid=e2fs
239 task:
240   env:
241     CPUS: 4
242     BUILD_JOBS: 4
243     TEST_JOBS: 8 # experimentally derived to be a decent choice
244     IMAGE_FAMILY: pg-ci-bullseye
246     CCACHE_DIR: /tmp/ccache_dir
247     DEBUGINFOD_URLS: "https://debuginfod.debian.net"
249     # Enable a reasonable set of sanitizers. Use the linux task for that, as
250     # it's one of the fastest tasks (without sanitizers). Also several of the
251     # sanitizers work best on linux.
252     #
253     # The overhead of alignment sanitizer is low, undefined behaviour has
254     # moderate overhead. Test alignment sanitizer in the meson task, as it
255     # does both 32 and 64 bit builds and is thus more likely to expose
256     # alignment bugs.
257     #
258     # Address sanitizer in contrast is somewhat expensive. Enable it in the
259     # autoconf task, as the meson task tests both 32 and 64bit.
260     #
261     # disable_coredump=0, abort_on_error=1: for useful backtraces in case of crashes
262     # print_stacktraces=1,verbosity=2, duh
263     # detect_leaks=0: too many uninteresting leak errors in short-lived binaries
264     UBSAN_OPTIONS: print_stacktrace=1:disable_coredump=0:abort_on_error=1:verbosity=2
265     ASAN_OPTIONS: print_stacktrace=1:disable_coredump=0:abort_on_error=1:detect_leaks=0
267     # SANITIZER_FLAGS is set in the tasks below
268     CFLAGS: -Og -ggdb -fno-sanitize-recover=all $SANITIZER_FLAGS
269     CXXFLAGS: $CFLAGS
270     LDFLAGS: $SANITIZER_FLAGS
271     CC: ccache gcc
272     CXX: ccache g++
274     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
275     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
277   <<: *linux_task_template
279   depends_on: SanityCheck
280   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
282   ccache_cache:
283     folder: ${CCACHE_DIR}
285   sysinfo_script: |
286     id
287     uname -a
288     cat /proc/cmdline
289     ulimit -a -H && ulimit -a -S
290     export
291   create_user_script: |
292     useradd -m postgres
293     chown -R postgres:postgres .
294     mkdir -p ${CCACHE_DIR}
295     chown -R postgres:postgres ${CCACHE_DIR}
296     echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
297     su postgres -c "ulimit -l -H && ulimit -l -S"
298   setup_core_files_script: |
299     mkdir -m 770 /tmp/cores
300     chown root:postgres /tmp/cores
301     sysctl kernel.core_pattern='/tmp/cores/%e-%s-%p.core'
303   setup_hosts_file_script: |
304     cat >> /etc/hosts <<-EOF
305       127.0.0.1 pg-loadbalancetest
306       127.0.0.2 pg-loadbalancetest
307       127.0.0.3 pg-loadbalancetest
308     EOF
310   setup_additional_packages_script: |
311     #apt-get update
312     #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
314   matrix:
315     - name: Linux - Debian Bullseye - Autoconf
317       env:
318         SANITIZER_FLAGS: -fsanitize=address
320       # Normally, the "relation segment" code basically has no coverage in our
321       # tests, because we (quite reasonably) don't generate tables large
322       # enough in tests. We've had plenty bugs that we didn't notice due the
323       # code not being exercised much. Thus specify a very small segment size
324       # here. Use a non-power-of-two segment size, given we currently allow
325       # that.
326       configure_script: |
327         su postgres <<-EOF
328           ./configure \
329             --enable-cassert --enable-debug --enable-tap-tests \
330             --enable-nls \
331             --with-segsize-blocks=6 \
332             \
333             ${LINUX_CONFIGURE_FEATURES} \
334             \
335             CLANG="ccache clang"
336         EOF
337       build_script: su postgres -c "make -s -j${BUILD_JOBS} world-bin"
338       upload_caches: ccache
340       test_world_script: |
341         su postgres <<-EOF
342           ulimit -c unlimited # default is 0
343           make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
344         EOF
346       on_failure:
347         <<: *on_failure_ac
349     - name: Linux - Debian Bullseye - Meson
351       env:
352         CCACHE_MAXSIZE: "400M" # tests two different builds
353         SANITIZER_FLAGS: -fsanitize=alignment,undefined
355       configure_script: |
356         su postgres <<-EOF
357           meson setup \
358             --buildtype=debug \
359             -Dcassert=true \
360             ${LINUX_MESON_FEATURES} \
361             -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
362             build
363         EOF
365       # Also build & test in a 32bit build - it's gotten rare to test that
366       # locally.
367       configure_32_script: |
368         su postgres <<-EOF
369           export CC='ccache gcc -m32'
370           meson setup \
371             --buildtype=debug \
372             -Dcassert=true \
373             ${LINUX_MESON_FEATURES} \
374             -Dllvm=disabled \
375             --pkg-config-path /usr/lib/i386-linux-gnu/pkgconfig/ \
376             -DPERL=perl5.32-i386-linux-gnu \
377             -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
378             build-32
379         EOF
381       build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
382       build_32_script: su postgres -c 'ninja -C build-32 -j${BUILD_JOBS}'
384       upload_caches: ccache
386       test_world_script: |
387         su postgres <<-EOF
388           ulimit -c unlimited
389           meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
390         EOF
391         # so that we don't upload 64bit logs if 32bit fails
392         rm -rf build/
394       # There's currently no coverage of icu with LANG=C in the buildfarm. We
395       # can easily provide some here by running one of the sets of tests that
396       # way. Newer versions of python insist on changing the LC_CTYPE away
397       # from C, prevent that with PYTHONCOERCECLOCALE.
398       test_world_32_script: |
399         su postgres <<-EOF
400           ulimit -c unlimited
401           PYTHONCOERCECLOCALE=0 LANG=C meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS}
402         EOF
404       on_failure:
405         <<: *on_failure_meson
407   on_failure:
408     cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
411 task:
412   name: macOS - Ventura - Meson
414   env:
415     CPUS: 4 # always get that much for cirrusci macOS instances
416     BUILD_JOBS: $CPUS
417     # Test performance regresses noticably when using all cores. 8 seems to
418     # work OK. See
419     # https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de
420     TEST_JOBS: 8
421     IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest
423     CIRRUS_WORKING_DIR: ${HOME}/pgsql/
424     CCACHE_DIR: ${HOME}/ccache
425     MACPORTS_CACHE: ${HOME}/macports-cache
427     CC: ccache cc
428     CXX: ccache c++
429     CFLAGS: -Og -ggdb
430     CXXFLAGS: -Og -ggdb
432   <<: *macos_task_template
434   depends_on: SanityCheck
435   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
437   sysinfo_script: |
438     id
439     uname -a
440     ulimit -a -H && ulimit -a -S
441     export
443   setup_core_files_script:
444     - mkdir ${HOME}/cores
445     - sudo sysctl kern.corefile="${HOME}/cores/core.%P"
447   # Use macports, even though homebrew is installed. The installation
448   # of the additional packages we need would take quite a while with
449   # homebrew, even if we cache the downloads. We can't cache all of
450   # homebrew, because it's already large. So we use macports. To cache
451   # the installation we create a .dmg file that we mount if it already
452   # exists.
453   # XXX: The reason for the direct p5.34* references is that we'd need
454   # the large macport tree around to figure out that p5-io-tty is
455   # actually p5.34-io-tty. Using the unversioned name works, but
456   # updates macports every time.
457   macports_cache:
458     folder: ${MACPORTS_CACHE}
459   setup_additional_packages_script: |
460     sh src/tools/ci/ci_macports_packages.sh \
461       ccache \
462       icu \
463       kerberos5 \
464       lz4 \
465       meson \
466       openldap \
467       openssl \
468       p5.34-io-tty \
469       p5.34-ipc-run \
470       python312 \
471       tcl \
472       zstd
473     # system python doesn't provide headers
474     sudo /opt/local/bin/port select python3 python312
475     # Make macports install visible for subsequent steps
476     echo PATH=/opt/local/sbin/:/opt/local/bin/:$PATH >> $CIRRUS_ENV
477   upload_caches: macports
479   ccache_cache:
480     folder: $CCACHE_DIR
481   configure_script: |
482     export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig/"
483     meson setup \
484       --buildtype=debug \
485       -Dextra_include_dirs=/opt/local/include \
486       -Dextra_lib_dirs=/opt/local/lib \
487       -Dcassert=true \
488       -Duuid=e2fs -Ddtrace=auto \
489       -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
490       build
492   build_script: ninja -C build -j${BUILD_JOBS}
493   upload_caches: ccache
495   test_world_script: |
496     ulimit -c unlimited # default is 0
497     ulimit -n 1024 # default is 256, pretty low
498     meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
500   on_failure:
501     <<: *on_failure_meson
502     cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
505 WINDOWS_ENVIRONMENT_BASE: &WINDOWS_ENVIRONMENT_BASE
506   env:
507     # Half the allowed per-user CPU cores
508     CPUS: 4
510     # The default cirrus working dir is in a directory msbuild complains about
511     CIRRUS_WORKING_DIR: "c:/cirrus"
512     # git's tar doesn't deal with drive letters, see
513     # https://postgr.es/m/b6782dc3-a7b0-ed56-175f-f8f54cb08d67%40dunslane.net
514     TAR: "c:/windows/system32/tar.exe"
515     # Avoids port conflicts between concurrent tap test runs
516     PG_TEST_USE_UNIX_SOCKETS: 1
517     PG_REGRESS_SOCK_DIR: "c:/cirrus/"
518     DISK_SIZE: 50
520   sysinfo_script: |
521     chcp
522     systeminfo
523     powershell -Command get-psdrive -psprovider filesystem
524     set
527 task:
528   name: Windows - Server 2019, VS 2019 - Meson & ninja
529   << : *WINDOWS_ENVIRONMENT_BASE
531   env:
532     TEST_JOBS: 8 # wild guess, data based value welcome
534     # Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That
535     # prevents crash reporting from working unless binaries do SetErrorMode()
536     # themselves. Furthermore, it appears that either python or, more likely,
537     # the C runtime has a bug where SEM_NOGPFAULTERRORBOX can very
538     # occasionally *trigger* a crash on process exit - which is hard to debug,
539     # given that it explicitly prevents crash dumps from working...
540     # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
541     CIRRUS_WINDOWS_ERROR_MODE: 0x8001
542     IMAGE_FAMILY: pg-ci-windows-ci-vs-2019
544   <<: *windows_task_template
546   depends_on: SanityCheck
547   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
549   setup_additional_packages_script: |
550     REM choco install -y --no-progress ...
552   setup_hosts_file_script: |
553     echo 127.0.0.1 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
554     echo 127.0.0.2 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
555     echo 127.0.0.3 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
556     type c:\Windows\System32\Drivers\etc\hosts
558   # Use /DEBUG:FASTLINK to avoid high memory usage during linking
559   configure_script: |
560     vcvarsall x64
561     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
563   build_script: |
564     vcvarsall x64
565     ninja -C build
567   check_world_script: |
568     vcvarsall x64
569     meson test %MTEST_ARGS% --num-processes %TEST_JOBS%
571   on_failure:
572     <<: *on_failure_meson
573     crashlog_artifacts:
574       path: "crashlog-*.txt"
575       type: text/plain
578 task:
579   << : *WINDOWS_ENVIRONMENT_BASE
580   name: Windows - Server 2019, MinGW64 - Meson
582   # due to resource constraints we don't run this task by default for now
583   trigger_type: manual
584   # worth using only_if despite being manual, otherwise this task will show up
585   # when e.g. ci-os-only: linux is used.
586   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*mingw.*'
587   # otherwise it'll be sorted before other tasks
588   depends_on: SanityCheck
590   env:
591     TEST_JOBS: 4 # higher concurrency causes occasional failures
592     CCACHE_DIR: C:/msys64/ccache
593     CCACHE_MAXSIZE: "500M"
594     CCACHE_SLOPPINESS: pch_defines,time_macros
595     CCACHE_DEPEND: 1
596     # for some reason mingw plpython cannot find its installation without this
597     PYTHONHOME: C:/msys64/ucrt64
598     # prevents MSYS bash from resetting error mode
599     MSYS: winjitdebug
600     # Start bash in current working directory
601     CHERE_INVOKING: 1
602     BASH: C:\msys64\usr\bin\bash.exe -l
603     IMAGE_FAMILY: pg-ci-windows-ci-mingw64
605   <<: *windows_task_template
607   ccache_cache:
608     folder: ${CCACHE_DIR}
610   setup_additional_packages_script: |
611     REM C:\msys64\usr\bin\pacman.exe -S --noconfirm ...
613   mingw_info_script: |
614     %BASH% -c "where gcc"
615     %BASH% -c "gcc --version"
616     %BASH% -c "where perl"
617     %BASH% -c "perl --version"
619   # disable -Dnls as the number of files it creates cause a noticable slowdown
620   configure_script: |
621     %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build"
623   build_script: |
624     %BASH% -c "ninja -C build"
626   upload_caches: ccache
628   test_world_script: |
629     %BASH% -c "meson test %MTEST_ARGS% --num-processes %TEST_JOBS%"
631   on_failure:
632     <<: *on_failure_meson
633     crashlog_artifacts:
634       path: "crashlog-*.txt"
635       type: text/plain
638 task:
639   name: CompilerWarnings
641   # To limit unnecessary work only run this once the SanityCheck
642   # succeeds. This is particularly important for this task as we intentionally
643   # use always: to continue after failures. Task that did not run count as a
644   # success, so we need to recheck SanityChecks's condition here ...
645   depends_on: SanityCheck
646   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*'
648   env:
649     CPUS: 4
650     BUILD_JOBS: 4
651     IMAGE_FAMILY: pg-ci-bullseye
653     # Use larger ccache cache, as this task compiles with multiple compilers /
654     # flag combinations
655     CCACHE_MAXSIZE: "1G"
656     CCACHE_DIR: "/tmp/ccache_dir"
658     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
659     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
661   <<: *linux_task_template
663   sysinfo_script: |
664     id
665     uname -a
666     cat /proc/cmdline
667     ulimit -a -H && ulimit -a -S
668     gcc -v
669     clang -v
670     export
672   ccache_cache:
673     folder: $CCACHE_DIR
675   setup_additional_packages_script: |
676     #apt-get update
677     #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
679   ###
680   # Test that code can be built with gcc/clang without warnings
681   ###
683   setup_script: echo "COPT=-Werror" > src/Makefile.custom
685   # Trace probes have a history of getting accidentally broken. Use the
686   # different compilers to build with different combinations of dtrace on/off
687   # and cassert on/off.
689   # gcc, cassert off, dtrace on
690   always:
691     gcc_warning_script: |
692       time ./configure \
693         --cache gcc.cache \
694         --enable-dtrace \
695         ${LINUX_CONFIGURE_FEATURES} \
696         CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
697       make -s -j${BUILD_JOBS} clean
698       time make -s -j${BUILD_JOBS} world-bin
700   # gcc, cassert on, dtrace off
701   always:
702     gcc_a_warning_script: |
703       time ./configure \
704         --cache gcc.cache \
705         --enable-cassert \
706         ${LINUX_CONFIGURE_FEATURES} \
707         CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
708       make -s -j${BUILD_JOBS} clean
709       time make -s -j${BUILD_JOBS} world-bin
711   # clang, cassert off, dtrace off
712   always:
713     clang_warning_script: |
714       time ./configure \
715         --cache clang.cache \
716         ${LINUX_CONFIGURE_FEATURES} \
717         CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
718       make -s -j${BUILD_JOBS} clean
719       time make -s -j${BUILD_JOBS} world-bin
721   # clang, cassert on, dtrace on
722   always:
723     clang_a_warning_script: |
724       time ./configure \
725         --cache clang.cache \
726         --enable-cassert \
727         --enable-dtrace \
728         ${LINUX_CONFIGURE_FEATURES} \
729         CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
730       make -s -j${BUILD_JOBS} clean
731       time make -s -j${BUILD_JOBS} world-bin
733   # cross-compile to windows
734   always:
735     mingw_cross_warning_script: |
736       time ./configure \
737         --host=x86_64-w64-mingw32 \
738         --enable-cassert \
739         --without-icu \
740         CC="ccache x86_64-w64-mingw32-gcc" \
741         CXX="ccache x86_64-w64-mingw32-g++"
742       make -s -j${BUILD_JOBS} clean
743       time make -s -j${BUILD_JOBS} world-bin
745   ###
746   # Verify docs can be built
747   ###
748   # XXX: Only do this if there have been changes in doc/ since last build
749   always:
750     docs_build_script: |
751       time ./configure \
752         --cache gcc.cache \
753         CC="ccache gcc" \
754         CXX="ccache g++" \
755         CLANG="ccache clang"
756       make -s -j${BUILD_JOBS} clean
757       time make -s -j${BUILD_JOBS} -C doc
759   ###
760   # Verify headerscheck / cpluspluscheck succeed
761   #
762   # - Don't use ccache, the files are uncacheable, polluting ccache's
763   #   cache
764   # - Use -fmax-errors, as particularly cpluspluscheck can be very verbose
765   # - XXX have to disable ICU to avoid errors:
766   #   https://postgr.es/m/20220323002024.f2g6tivduzrktgfa%40alap3.anarazel.de
767   ###
768   always:
769     headers_headerscheck_script: |
770       time ./configure \
771         ${LINUX_CONFIGURE_FEATURES} \
772         --without-icu \
773         --quiet \
774         CC="gcc" CXX"=g++" CLANG="clang"
775       make -s -j${BUILD_JOBS} clean
776       time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
777     headers_cpluspluscheck_script: |
778       time make -s cpluspluscheck EXTRAFLAGS='-fmax-errors=10'
780   always:
781     upload_caches: ccache