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
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
25 PGCTLTIMEOUT: 120 # avoids spurious failures during parallel tests
26 TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
27 PG_TEST_EXTRA: kerberos ldap ssl
30 # What files to preserve in case tests fail
31 on_failure: &on_failure
43 # FreeBSD on GCP is slow when running with larger number of CPUS /
44 # jobs. Using one more job than cpus seems to work best.
49 CCACHE_DIR: /tmp/ccache_dir
51 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
53 compute_engine_instance:
54 image_project: $IMAGE_PROJECT
55 image: family/pg-ci-freebsd-13-0
64 ulimit -a -H && ulimit -a -S
69 # Workaround around performance issues due to 32KB block size
70 repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
73 chown -R postgres:postgres .
74 mkdir -p ${CCACHE_DIR}
75 chown -R postgres:postgres ${CCACHE_DIR}
76 setup_core_files_script: |
77 mkdir -m 770 /tmp/cores
78 chown root:postgres /tmp/cores
79 sysctl kern.corefile='/tmp/cores/%N.%P.core'
80 setup_additional_packages_script: |
83 # NB: Intentionally build without --with-llvm. The freebsd image size is
84 # already large enough to make VM startup slow, and even without llvm
85 # freebsd already takes longer than other platforms except for windows.
89 --enable-cassert --enable-debug --enable-tap-tests \
102 --with-tcl --with-tclconfig=/usr/local/lib/tcl8.6/ \
106 --with-includes=/usr/local/include \
107 --with-libs=/usr/local/lib \
113 build_script: su postgres -c "gmake -s -j${BUILD_JOBS} world-bin"
114 upload_caches: ccache
116 # The use of script avoids make -Otarget complaints about fcntl() on
117 # platforms without support for locking pipes. See also
118 # https://savannah.gnu.org/bugs/?60774
119 # script uses pseudo-ttys, which do support locking.
121 - su postgres -c "time script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}"
125 cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
128 # configure feature flags, shared between the task running the linux tests and
129 # the CompilerWarnings task
130 LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
144 --with-tcl --with-tclconfig=/usr/lib/tcl8.6/
150 name: Linux - Debian Bullseye
155 TEST_JOBS: 8 # experimentally derived to be a decent choice
157 CCACHE_DIR: /tmp/ccache_dir
158 DEBUGINFOD_URLS: "https://debuginfod.debian.net"
160 LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
162 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
164 compute_engine_instance:
165 image_project: $IMAGE_PROJECT
166 image: family/pg-ci-bullseye
172 folder: ${CCACHE_DIR}
178 ulimit -a -H && ulimit -a -S
180 create_user_script: |
182 chown -R postgres:postgres .
183 mkdir -p ${CCACHE_DIR}
184 chown -R postgres:postgres ${CCACHE_DIR}
185 echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
186 su postgres -c "ulimit -l -H && ulimit -l -S"
187 setup_core_files_script: |
188 mkdir -m 770 /tmp/cores
189 chown root:postgres /tmp/cores
190 sysctl kernel.core_pattern='/tmp/cores/%e-%s-%p.core'
191 setup_additional_packages_script: |
193 #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
198 --enable-cassert --enable-debug --enable-tap-tests \
201 ${LINUX_CONFIGURE_FEATURES} \
205 CLANG="ccache clang" \
209 build_script: su postgres -c "make -s -j${BUILD_JOBS} world-bin"
210 upload_caches: ccache
214 ulimit -c unlimited # default is 0
215 make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
220 cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
224 name: macOS - Monterey
227 CPUS: 12 # always get that much for cirrusci macOS instances
229 TEST_JOBS: $CPUS # already fast enough to not be worth tuning
231 CIRRUS_WORKING_DIR: ${HOME}/pgsql/
232 CCACHE_DIR: ${HOME}/ccache
233 HOMEBREW_CACHE: ${HOME}/homebrew-cache
234 PERL5LIB: ${HOME}/perl5/lib/perl5
236 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
244 ulimit -a -H && ulimit -a -S
247 setup_core_files_script:
248 - mkdir ${HOME}/cores
249 - sudo sysctl kern.corefile="${HOME}/cores/core.%P"
254 - perl -mIPC::Run -e 1 || cpan -T IPC::Run
255 - perl -mIO::Pty -e 1 || cpan -T IO::Pty
259 # XXX: Could we instead install homebrew into a cached directory? The
260 # homebrew installation takes a good bit of time every time, even if the
261 # packages do not need to be downloaded.
263 folder: $HOMEBREW_CACHE
264 setup_additional_packages_script: |
278 brew cleanup -s # to reduce cache size
279 upload_caches: homebrew
284 brewpath="/usr/local"
285 INCLUDES="${brewpath}/include:${INCLUDES}"
286 LIBS="${brewpath}/lib:${LIBS}"
288 for pkg in icu4c krb5 openldap openssl zstd ; do
289 pkgpath="${brewpath}/opt/${pkg}"
290 INCLUDES="${pkgpath}/include:${INCLUDES}"
291 LIBS="${pkgpath}/lib:${LIBS}"
292 PKG_CONFIG_PATH="${pkgpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
295 export PKG_CONFIG_PATH
298 --enable-cassert --enable-debug --enable-tap-tests \
311 --with-tcl --with-tclconfig=${brewpath}/opt/tcl-tk/lib/ \
315 --prefix=${HOME}/install \
316 --with-includes="${INCLUDES}" \
317 --with-libs="${LIBS}" \
321 CLANG="ccache ${brewpath}/llvm/bin/ccache" \
323 CXXFLAGS="-Og -ggdb" \
325 LLVM_CONFIG=${brewpath}/llvm/bin/llvm-config \
327 build_script: gmake -s -j${BUILD_JOBS} world-bin
328 upload_caches: ccache
331 ulimit -c unlimited # default is 0
332 ulimit -n 1024 # default is 256, pretty low
333 # See freebsd use of script for explanation
334 script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}
338 cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
342 name: Windows - Server 2019, VS 2019
345 # Half the allowed per-user CPU cores
348 # Our windows infrastructure doesn't have test concurrency above the level
349 # of a single vcregress test target. Due to that, it's useful to run prove
350 # with multiple jobs. For the other tasks it isn't, because two sources
351 # (make and prove) of concurrency can overload machines.
353 # The concrete choice of 10 is based on a small bit of experimentation and
354 # likely can be improved upon further.
355 PROVE_FLAGS: -j10 --timer
357 # The default cirrus working dir is in a directory msbuild complains about
358 CIRRUS_WORKING_DIR: "c:/cirrus"
359 # Avoid re-installing over and over
361 # git's tar doesn't deal with drive letters, see
362 # https://postgr.es/m/b6782dc3-a7b0-ed56-175f-f8f54cb08d67%40dunslane.net
363 TAR: "c:/windows/system32/tar.exe"
364 # Avoids port conflicts between concurrent tap test runs
365 PG_TEST_USE_UNIX_SOCKETS: 1
366 PG_REGRESS_SOCK_DIR: "c:/cirrus/"
367 # -m enables parallelism
368 # verbosity:minimal + Summary reduce verbosity, while keeping a summary of
370 # ForceNoAlign prevents msbuild from introducing line-breaks for long lines
371 # disable file tracker, we're never going to rebuild, and it slows down the
373 MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo
375 # If tests hang forever, cirrus eventually times out. In that case log
376 # output etc is not uploaded, making the problem hard to debug. Of course
377 # tests internally should have shorter timeouts, but that's proven to not
378 # be sufficient. 15min currently is fast enough to finish individual test
380 T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m"
382 # startcreate_script starts a postgres instance that we don't want to get
383 # killed at the end of that script (it's stopped in stop_script). Can't
384 # trivially use background_scripts because a) need pg_ctl's dropping of
385 # permissions b) need to wait for startup to have finished, and we don't
386 # currently have a tool for that...
387 CIRRUS_ESCAPING_PROCESSES: 1
389 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
392 image: $CONTAINER_REPO/windows_ci_vs_2019:latest
399 powershell -Command get-psdrive -psprovider filesystem
402 setup_additional_packages_script: |
403 REM choco install -y --no-progress ...
406 # copy errors out when using forward slashes
407 - copy src\tools\ci\windows_build_config.pl src\tools\msvc\config.pl
409 - perl src/tools/msvc/mkvcbuild.pl
412 - msbuild %MSBFLAGS% pgsql.sln
414 # Installation on windows currently only completely works from src/tools/msvc
415 - cd src/tools/msvc && perl install.pl %CIRRUS_WORKING_DIR%/tmp_install
417 test_regress_parallel_script: |
418 %T_C% perl src/tools/msvc/vcregress.pl check parallel
419 startcreate_script: |
420 rem paths to binaries need backslashes
421 tmp_install\bin\pg_ctl.exe initdb -D tmp_check/db -l tmp_check/initdb.log --options=--no-sync
422 echo include '%TEMP_CONFIG%' >> tmp_check/db/postgresql.conf
423 tmp_install\bin\pg_ctl.exe start -D tmp_check/db -l tmp_check/postmaster.log
426 %T_C% perl src/tools/msvc/vcregress.pl plcheck
427 test_isolation_script: |
428 %T_C% perl src/tools/msvc/vcregress.pl isolationcheck
429 test_modules_script: |
430 %T_C% perl src/tools/msvc/vcregress.pl modulescheck
431 test_contrib_script: |
432 %T_C% perl src/tools/msvc/vcregress.pl contribcheck
434 tmp_install\bin\pg_ctl.exe stop -D tmp_check/db -l tmp_check/postmaster.log
437 %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/ssl/
438 test_subscription_script: |
439 %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/subscription/
440 test_authentication_script: |
441 %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/authentication/
442 test_recovery_script: |
443 %T_C% perl src/tools/msvc/vcregress.pl recoverycheck
445 %T_C% perl src/tools/msvc/vcregress.pl bincheck
447 rem tries to build additional stuff
449 rem References ecpg_regression.proj in the current dir
451 %T_C% perl vcregress.pl ecpgcheck
456 path: "crashlog-*.txt"
461 name: CompilerWarnings
463 # To limit unnecessary work only run this once the normal linux test succeeds
465 - Linux - Debian Bullseye
471 # Use larger ccache cache, as this task compiles with multiple compilers /
473 CCACHE_MAXSIZE: "1GB"
474 CCACHE_DIR: "/tmp/ccache_dir"
476 LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
478 # task that did not run, count as a success, so we need to recheck Linux'
480 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
483 image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest
490 ulimit -a -H && ulimit -a -S
498 setup_additional_packages_script: |
500 #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
503 # Test that code can be built with gcc/clang without warnings
506 setup_script: echo "COPT=-Werror" > src/Makefile.custom
508 # Trace probes have a history of getting accidentally broken. Use the
509 # different compilers to build with different combinations of dtrace on/off
510 # and cassert on/off.
512 # gcc, cassert off, dtrace on
514 gcc_warning_script: |
518 ${LINUX_CONFIGURE_FEATURES} \
519 CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
520 make -s -j${BUILD_JOBS} clean
521 time make -s -j${BUILD_JOBS} world-bin
523 # gcc, cassert on, dtrace off
525 gcc_a_warning_script: |
529 ${LINUX_CONFIGURE_FEATURES} \
530 CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
531 make -s -j${BUILD_JOBS} clean
532 time make -s -j${BUILD_JOBS} world-bin
534 # clang, cassert off, dtrace off
536 clang_warning_script: |
538 --cache clang.cache \
539 ${LINUX_CONFIGURE_FEATURES} \
540 CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
541 make -s -j${BUILD_JOBS} clean
542 time make -s -j${BUILD_JOBS} world-bin
544 # clang, cassert on, dtrace on
546 clang_a_warning_script: |
548 --cache clang.cache \
551 ${LINUX_CONFIGURE_FEATURES} \
552 CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
553 make -s -j${BUILD_JOBS} clean
554 time make -s -j${BUILD_JOBS} world-bin
556 # cross-compile to windows
558 mingw_cross_warning_script: |
560 --host=x86_64-w64-mingw32 \
562 CC="ccache x86_64-w64-mingw32-gcc" \
563 CXX="ccache x86_64-w64-mingw32-g++"
564 make -s -j${BUILD_JOBS} clean
565 time make -s -j${BUILD_JOBS} world-bin
568 # Verify docs can be built
570 # XXX: Only do this if there have been changes in doc/ since last build
578 make -s -j${BUILD_JOBS} clean
579 time make -s -j${BUILD_JOBS} -C doc
582 # Verify headerscheck / cpluspluscheck succeed
584 # - Don't use ccache, the files are uncacheable, polluting ccache's
586 # - Use -fmax-errors, as particularly cpluspluscheck can be very verbose
587 # - XXX have to disable ICU to avoid errors:
588 # https://postgr.es/m/20220323002024.f2g6tivduzrktgfa%40alap3.anarazel.de
589 # - XXX: the -Wno-register avoids verbose warnings:
590 # https://postgr.es/m/20220308181837.aun3tdtdvao4vb7o%40alap3.anarazel.de
593 headers_headerscheck_script: |
595 ${LINUX_CONFIGURE_FEATURES} \
598 CC="gcc" CXX"=g++" CLANG="clang"
599 make -s -j${BUILD_JOBS} clean
600 time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
601 headers_cpluspluscheck_script: |
602 time make -s cpluspluscheck EXTRAFLAGS='-Wno-register -fmax-errors=10'
605 upload_caches: ccache