22#
33# For instructions on how to enable the CI integration in a repository and
44# further details, see src/tools/ci/README
5+ #
6+ #
7+ # NB: Different tasks intentionally test with different, non-default,
8+ # configurations, to increase the chance of catching problems. Each task with
9+ # non-obvious non-default documents their oddity at the top of the task,
10+ # prefixed by "SPECIAL:".
511
612
713env :
1723 CHECK : check-world PROVE_FLAGS=$PROVE_FLAGS
1824 CHECKFLAGS : -Otarget
1925 PROVE_FLAGS : --timer
26+ # Build test dependencies as part of the build step, to see compiler
27+ # errors/warnings in one place.
28+ MBUILD_TARGET : all testprep
2029 MTEST_ARGS : --print-errorlogs --no-rebuild -C build
2130 PGCTLTIMEOUT : 120 # avoids spurious failures during parallel tests
2231 TEMP_CONFIG : ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
23- PG_TEST_EXTRA : kerberos ldap ssl libpq_encryption load_balance
32+ PG_TEST_EXTRA : kerberos ldap ssl libpq_encryption load_balance oauth
2433
2534
2635# What files to preserve in case tests fail
@@ -52,6 +61,10 @@ on_failure_meson: &on_failure_meson
5261
5362# To avoid unnecessarily spinning up a lot of VMs / containers for entirely
5463# broken commits, have a minimal task that all others depend on.
64+ #
65+ # SPECIAL:
66+ # - Builds with --auto-features=disabled and thus almost no enabled
67+ # dependencies
5568task :
5669 name : SanityCheck
5770
99112 EOF
100113 build_script : |
101114 su postgres <<-EOF
102- ninja -C build -j${BUILD_JOBS}
115+ ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
103116 EOF
104117 upload_caches : ccache
105118
@@ -122,21 +135,33 @@ task:
122135 src/tools/ci/cores_backtrace.sh linux /tmp/cores
123136
124137
138+ # SPECIAL:
139+ # - Uses postgres specific CPPFLAGS that increase test coverage
140+ # - Specifies configuration options that test reading/writing/copying of node trees
141+ # - Specifies debug_parallel_query=regress, to catch related issues during CI
142+ # - Also runs tests against a running postgres instance, see test_running_script
125143task :
126- name : FreeBSD - 13 - Meson
144+ name : FreeBSD - Meson
127145
128146 env :
129147 CPUS : 4
130148 BUILD_JOBS : 4
131149 TEST_JOBS : 8
132- IMAGE_FAMILY : pg-ci-freebsd-13
150+ IMAGE_FAMILY : pg-ci-freebsd
133151 DISK_SIZE : 50
134152
135153 CCACHE_DIR : /tmp/ccache_dir
136154 CPPFLAGS : -DRELCACHE_FORCE_RELEASE -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS
137155 CFLAGS : -Og -ggdb
138156
139- PG_TEST_INITDB_EXTRA_OPTS : -c debug_copy_parse_plan_trees=on -c debug_write_read_parse_plan_trees=on -c debug_raw_expression_coverage_test=on
157+ # Several buildfarm animals enable these options. Without testing them
158+ # during CI, it would be easy to cause breakage on the buildfarm with CI
159+ # passing.
160+ PG_TEST_INITDB_EXTRA_OPTS : >-
161+ -c debug_copy_parse_plan_trees=on
162+ -c debug_write_read_parse_plan_trees=on
163+ -c debug_raw_expression_coverage_test=on
164+ -c debug_parallel_query=regress
140165 PG_TEST_PG_UPGRADE_MODE : --link
141166
142167 << : *freebsd_task_template
@@ -152,8 +177,7 @@ task:
152177
153178 ccache_cache :
154179 folder : $CCACHE_DIR
155- # Work around performance issues due to 32KB block size
156- repartition_script : src/tools/ci/gcp_freebsd_repartition.sh
180+ setup_ram_disk_script : src/tools/ci/gcp_ram_disk.sh
157181 create_user_script : |
158182 pw useradd postgres
159183 chown -R postgres:postgres .
@@ -178,7 +202,7 @@ task:
178202 -Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
179203 build
180204 EOF
181- build_script : su postgres -c 'ninja -C build -j${BUILD_JOBS}'
205+ build_script : su postgres -c 'ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET} '
182206 upload_caches : ccache
183207
184208 test_world_script : |
@@ -213,12 +237,120 @@ task:
213237 cores_script : src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
214238
215239
240+ task :
241+ depends_on : SanityCheck
242+ trigger_type : manual
243+
244+ env :
245+ # Below are experimentally derived to be a decent choice.
246+ CPUS : 4
247+ BUILD_JOBS : 8
248+ TEST_JOBS : 8
249+
250+ # Default working directory is /tmp, but its total size (1.2 GB) is not
251+ # enough, so different working and cache directory are set.
252+ CIRRUS_WORKING_DIR : /home/postgres/postgres
253+ CCACHE_DIR : /home/postgres/cache
254+
255+ PATH : /usr/sbin:$PATH
256+ CORE_DUMP_DIR : /var/crash
257+
258+ matrix :
259+ - name : NetBSD - Meson
260+ only_if : $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
261+ env :
262+ OS_NAME : netbsd
263+ IMAGE_FAMILY : pg-ci-netbsd-postgres
264+ PKGCONFIG_PATH : ' /usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig'
265+ # initdb fails with: 'invalid locale settings' error on NetBSD.
266+ # Force 'LANG' and 'LC_*' variables to be 'C'.
267+ # See https://postgr.es/m/2490325.1734471752%40sss.pgh.pa.us
268+ LANG : " C"
269+ LC_ALL : " C"
270+ # -Duuid is not set for the NetBSD, see the comment below, above
271+ # configure_script, for more information.
272+ setup_additional_packages_script : |
273+ #pkgin -y install ...
274+ << : *netbsd_task_template
275+
276+ - name : OpenBSD - Meson
277+ only_if : $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
278+ env :
279+ OS_NAME : openbsd
280+ IMAGE_FAMILY : pg-ci-openbsd-postgres
281+ PKGCONFIG_PATH : ' /usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
282+ UUID : -Duuid=e2fs
283+ TCL : -Dtcl_version=tcl86
284+ setup_additional_packages_script : |
285+ #pkg_add -I ...
286+ # Always core dump to ${CORE_DUMP_DIR}
287+ set_core_dump_script : sysctl -w kern.nosuidcoredump=2
288+ << : *openbsd_task_template
289+
290+ sysinfo_script : |
291+ locale
292+ id
293+ uname -a
294+ ulimit -a -H && ulimit -a -S
295+ env
296+
297+ ccache_cache :
298+ folder : $CCACHE_DIR
299+ setup_ram_disk_script : src/tools/ci/gcp_ram_disk.sh
300+ create_user_script : |
301+ useradd postgres
302+ chown -R postgres:users /home/postgres
303+ mkdir -p ${CCACHE_DIR}
304+ chown -R postgres:users ${CCACHE_DIR}
305+ setup_core_files_script : |
306+ mkdir -p ${CORE_DUMP_DIR}
307+ chmod -R 770 ${CORE_DUMP_DIR}
308+ chown -R postgres:users ${CORE_DUMP_DIR}
309+
310+ # -Duuid=bsd is not set since 'bsd' uuid option
311+ # is not working on NetBSD & OpenBSD. See
312+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
313+ # And other uuid options are not available on NetBSD.
314+ configure_script : |
315+ su postgres <<-EOF
316+ meson setup \
317+ --buildtype=debugoptimized \
318+ --pkg-config-path ${PKGCONFIG_PATH} \
319+ -Dcassert=true -Dinjection_points=true \
320+ -Dssl=openssl ${UUID} ${TCL} \
321+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
322+ build
323+ EOF
324+
325+ build_script : su postgres -c 'ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}'
326+ upload_caches : ccache
327+
328+ test_world_script : |
329+ su postgres <<-EOF
330+ ulimit -c unlimited
331+ # Otherwise tests will fail on OpenBSD, due to inability to start enough
332+ # processes.
333+ ulimit -p 256
334+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
335+ EOF
336+
337+ on_failure :
338+ << : *on_failure_meson
339+ cores_script : |
340+ # Although we try to configure the OS to core dump inside
341+ # ${CORE_DUMP_DIR}, they may not obey this. So, move core files to the
342+ # ${CORE_DUMP_DIR} directory.
343+ find build/ -type f -name '*.core' -exec mv '{}' ${CORE_DUMP_DIR} \;
344+ src/tools/ci/cores_backtrace.sh ${OS_NAME} ${CORE_DUMP_DIR}
345+
346+
216347# configure feature flags, shared between the task running the linux tests and
217348# the CompilerWarnings task
218349LINUX_CONFIGURE_FEATURES : &LINUX_CONFIGURE_FEATURES >-
219350 --with-gssapi
220351 --with-icu
221352 --with-ldap
353+ --with-libcurl
222354 --with-libxml
223355 --with-libxslt
224356 --with-llvm
@@ -238,6 +370,7 @@ LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
238370 -Duuid=e2fs
239371
240372
373+ # Check SPECIAL in the matrix: below
241374task :
242375 env :
243376 CPUS : 4
@@ -316,6 +449,10 @@ task:
316449 #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
317450
318451 matrix :
452+ # SPECIAL:
453+ # - Uses address sanitizer, sanitizer failures are typically printed in
454+ # the server log
455+ # - Configures postgres with a small segment size
319456 - name : Linux - Debian Bookworm - Autoconf
320457
321458 env :
@@ -334,6 +471,8 @@ task:
334471 --enable-cassert --enable-injection-points --enable-debug \
335472 --enable-tap-tests --enable-nls \
336473 --with-segsize-blocks=6 \
474+ --with-libnuma \
475+ --with-liburing \
337476 \
338477 ${LINUX_CONFIGURE_FEATURES} \
339478 \
@@ -351,11 +490,18 @@ task:
351490 on_failure :
352491 << : *on_failure_ac
353492
493+ # SPECIAL:
494+ # - Uses undefined behaviour and alignment sanitizers, sanitizer failures
495+ # are typically printed in the server log
496+ # - Test both 64bit and 32 bit builds
497+ # - uses io_method=io_uring
354498 - name : Linux - Debian Bookworm - Meson
355499
356500 env :
357501 CCACHE_MAXSIZE : " 400M" # tests two different builds
358502 SANITIZER_FLAGS : -fsanitize=alignment,undefined
503+ PG_TEST_INITDB_EXTRA_OPTS : >-
504+ -c io_method=io_uring
359505
360506 configure_script : |
361507 su postgres <<-EOF
@@ -378,11 +524,21 @@ task:
378524 -Dllvm=disabled \
379525 --pkg-config-path /usr/lib/i386-linux-gnu/pkgconfig/ \
380526 -DPERL=perl5.36-i386-linux-gnu \
527+ -Dlibnuma=disabled \
381528 build-32
382529 EOF
383530
384- build_script : su postgres -c 'ninja -C build -j${BUILD_JOBS}'
385- build_32_script : su postgres -c 'ninja -C build-32 -j${BUILD_JOBS}'
531+ build_script : |
532+ su postgres <<-EOF
533+ ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
534+ ninja -C build -t missingdeps
535+ EOF
536+
537+ build_32_script : |
538+ su postgres <<-EOF
539+ ninja -C build-32 -j${BUILD_JOBS} ${MBUILD_TARGET}
540+ ninja -C build -t missingdeps
541+ EOF
386542
387543 upload_caches : ccache
388544
@@ -411,6 +567,11 @@ task:
411567 cores_script : src/tools/ci/cores_backtrace.sh linux /tmp/cores
412568
413569
570+ # NB: macOS is by far the most expensive OS to run CI for, therefore no
571+ # expensive additional checks should be added.
572+ #
573+ # SPECIAL:
574+ # - Enables --clone for pg_upgrade and pg_combinebackup
414575task :
415576 name : macOS - Sonoma - Meson
416577
@@ -503,7 +664,7 @@ task:
503664 -Duuid=e2fs -Ddtrace=auto \
504665 build
505666
506- build_script : ninja -C build -j${BUILD_JOBS}
667+ build_script : ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
507668 upload_caches : ccache
508669
509670 test_world_script : |
@@ -576,7 +737,8 @@ task:
576737
577738 build_script : |
578739 vcvarsall x64
579- ninja -C build
740+ ninja -C build %MBUILD_TARGET%
741+ ninja -C build -t missingdeps
580742
581743 check_world_script : |
582744 vcvarsall x64
@@ -634,7 +796,7 @@ task:
634796 %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Dinjection_points=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build"
635797
636798 build_script : |
637- %BASH% -c "ninja -C build"
799+ %BASH% -c "ninja -C build ${MBUILD_TARGET} "
638800
639801 upload_caches : ccache
640802
0 commit comments