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}
77 mkdir -m 770 /tmp/cores
78 chown root:postgres /tmp/cores
79 sysctl kern.corefile='/tmp/cores/%N.%P.core'
81 # NB: Intentionally build without --with-llvm. The freebsd image size is
82 # already large enough to make VM startup slow, and even without llvm
83 # freebsd already takes longer than other platforms except for windows.
87 --enable-cassert --enable-debug --enable-tap-tests \
100 --with-tcl --with-tclconfig=/usr/local/lib/tcl8.6/ \
103 --with-includes=/usr/local/include \
104 --with-libs=/usr/local/lib \
110 build_script: su postgres -c "gmake -s -j${BUILD_JOBS} world-bin"
111 upload_caches: ccache
113 # The use of script avoids make -Otarget complaints about fcntl() on
114 # platforms without support for locking pipes. See also
115 # https://savannah.gnu.org/bugs/?60774
116 # script uses pseudo-ttys, which do support locking.
118 - su postgres -c "time script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}"
122 cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
125 # configure feature flags, shared between the task running the linux tests and
126 # the CompilerWarnings task
127 LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
141 --with-tcl --with-tclconfig=/usr/lib/tcl8.6/
146 name: Linux - Debian Bullseye
151 TEST_JOBS: 8 # experimentally derived to be a decent choice
153 CCACHE_DIR: /tmp/ccache_dir
154 DEBUGINFOD_URLS: "https://debuginfod.debian.net"
156 LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
158 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
160 compute_engine_instance:
161 image_project: $IMAGE_PROJECT
162 image: family/pg-ci-bullseye
168 folder: ${CCACHE_DIR}
174 ulimit -a -H && ulimit -a -S
176 create_user_script: |
178 chown -R postgres:postgres .
179 mkdir -p ${CCACHE_DIR}
180 chown -R postgres:postgres ${CCACHE_DIR}
181 echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
182 su postgres -c "ulimit -l -H && ulimit -l -S"
183 setup_cores_script: |
184 mkdir -m 770 /tmp/cores
185 chown root:postgres /tmp/cores
186 sysctl kernel.core_pattern='/tmp/cores/%e-%s-%p.core'
191 --enable-cassert --enable-debug --enable-tap-tests \
194 ${LINUX_CONFIGURE_FEATURES} \
198 CLANG="ccache clang" \
202 build_script: su postgres -c "make -s -j${BUILD_JOBS} world-bin"
203 upload_caches: ccache
207 ulimit -c unlimited # default is 0
208 make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
213 cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
217 name: macOS - Monterey
220 CPUS: 12 # always get that much for cirrusci macOS instances
222 TEST_JOBS: $CPUS # already fast enough to not be worth tuning
224 CIRRUS_WORKING_DIR: ${HOME}/pgsql/
225 CCACHE_DIR: ${HOME}/ccache
226 HOMEBREW_CACHE: ${HOME}/homebrew-cache
227 PERL5LIB: ${HOME}/perl5/lib/perl5
229 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
237 ulimit -a -H && ulimit -a -S
241 - mkdir ${HOME}/cores
242 - sudo sysctl kern.corefile="${HOME}/cores/core.%P"
247 - perl -mIPC::Run -e 1 || cpan -T IPC::Run
248 - perl -mIO::Pty -e 1 || cpan -T IO::Pty
252 # XXX: Could we instead install homebrew into a cached directory? The
253 # homebrew installation takes a good bit of time every time, even if the
254 # packages do not need to be downloaded.
256 folder: $HOMEBREW_CACHE
257 homebrew_install_script: |
270 brew cleanup -s # to reduce cache size
271 upload_caches: homebrew
276 brewpath="/usr/local"
277 INCLUDES="${brewpath}/include:${INCLUDES}"
278 LIBS="${brewpath}/lib:${LIBS}"
280 for pkg in icu4c krb5 openldap openssl ; do
281 pkgpath="${brewpath}/opt/${pkg}"
282 INCLUDES="${pkgpath}/include:${INCLUDES}"
283 LIBS="${pkgpath}/lib:${LIBS}"
284 PKG_CONFIG_PATH="${pkgpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
287 export PKG_CONFIG_PATH
290 --enable-cassert --enable-debug --enable-tap-tests \
303 --with-tcl --with-tclconfig=${brewpath}/opt/tcl-tk/lib/ \
306 --prefix=${HOME}/install \
307 --with-includes="${INCLUDES}" \
308 --with-libs="${LIBS}" \
312 CLANG="ccache ${brewpath}/llvm/bin/ccache" \
314 CXXFLAGS="-O0 -ggdb" \
316 LLVM_CONFIG=${brewpath}/llvm/bin/llvm-config \
318 build_script: gmake -s -j${BUILD_JOBS} world-bin
319 upload_caches: ccache
322 ulimit -c unlimited # default is 0
323 ulimit -n 1024 # default is 256, pretty low
324 # See freebsd use of script for explanation
325 script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}
329 cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
333 name: Windows - Server 2019, VS 2019
336 # Half the allowed per-user CPU cores
339 # Our windows infrastructure doesn't have test concurrency above the level
340 # of a single vcregress test target. Due to that, it's useful to run prove
341 # with multiple jobs. For the other tasks it isn't, because two sources
342 # (make and prove) of concurrency can overload machines.
344 # The concrete choice of 10 is based on a small bit of experimentation and
345 # likely can be improved upon further.
346 PROVE_FLAGS: -j10 --timer
348 # The default cirrus working dir is in a directory msbuild complains about
349 CIRRUS_WORKING_DIR: "c:/cirrus"
350 # Avoid re-installing over and over
352 # git's tar doesn't deal with drive letters, see
353 # https://postgr.es/m/b6782dc3-a7b0-ed56-175f-f8f54cb08d67%40dunslane.net
354 TAR: "c:/windows/system32/tar.exe"
355 # Avoids port conflicts between concurrent tap test runs
356 PG_TEST_USE_UNIX_SOCKETS: 1
357 PG_REGRESS_SOCK_DIR: "c:/cirrus/"
358 # -m enables parallelism
359 # verbosity:minimal + Summary reduce verbosity, while keeping a summary of
361 # ForceNoAlign prevents msbuild from introducing line-breaks for long lines
362 # disable file tracker, we're never going to rebuild, and it slows down the
364 MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo
366 # If tests hang forever, cirrus eventually times out. In that case log
367 # output etc is not uploaded, making the problem hard to debug. Of course
368 # tests internally should have shorter timeouts, but that's proven to not
369 # be sufficient. 15min currently is fast enough to finish individual test
371 T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m"
373 # Temporarily work around cirrus-ci bug causing processes started from a
374 # script to be killed, even if intentionally running in background. See
375 # https://github.com/cirruslabs/cirrus-ci-agent/issues/218
376 # https://postgr.es/m/CA%2BhUKGKx7k14n2nAALSvv6M_AB6oHasNBA65X6Dvo8hwfi9y0A%40mail.gmail.com
377 CIRRUS_AGENT_VERSION: 1.73.2
379 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
382 image: $CONTAINER_REPO/windows_ci_vs_2019:latest
389 powershell -Command get-psdrive -psprovider filesystem
393 # copy errors out when using forward slashes
394 - copy src\tools\ci\windows_build_config.pl src\tools\msvc\config.pl
396 - perl src/tools/msvc/mkvcbuild.pl
399 - msbuild %MSBFLAGS% pgsql.sln
401 # Installation on windows currently only completely works from src/tools/msvc
402 - cd src/tools/msvc && perl install.pl %CIRRUS_WORKING_DIR%/tmp_install
404 test_regress_parallel_script: |
405 %T_C% perl src/tools/msvc/vcregress.pl check parallel
406 startcreate_script: |
407 rem paths to binaries need backslashes
408 tmp_install\bin\pg_ctl.exe initdb -D tmp_check/db -l tmp_check/initdb.log --options=--no-sync
409 echo include '%TEMP_CONFIG%' >> tmp_check/db/postgresql.conf
410 tmp_install\bin\pg_ctl.exe start -D tmp_check/db -l tmp_check/postmaster.log
413 %T_C% perl src/tools/msvc/vcregress.pl plcheck
414 test_isolation_script: |
415 %T_C% perl src/tools/msvc/vcregress.pl isolationcheck
416 test_modules_script: |
417 %T_C% perl src/tools/msvc/vcregress.pl modulescheck
418 test_contrib_script: |
419 %T_C% perl src/tools/msvc/vcregress.pl contribcheck
421 tmp_install\bin\pg_ctl.exe stop -D tmp_check/db -l tmp_check/postmaster.log
424 %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/ssl/
425 test_subscription_script: |
426 %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/subscription/
427 test_authentication_script: |
428 %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/authentication/
429 test_recovery_script: |
430 %T_C% perl src/tools/msvc/vcregress.pl recoverycheck
432 %T_C% perl src/tools/msvc/vcregress.pl bincheck
433 test_pg_upgrade_script: |
434 %T_C% perl src/tools/msvc/vcregress.pl upgradecheck
436 rem tries to build additional stuff
438 rem References ecpg_regression.proj in the current dir
440 %T_C% perl vcregress.pl ecpgcheck
445 path: "crashlog-*.txt"
450 name: CompilerWarnings
452 # To limit unnecessary work only run this once the normal linux test succeeds
454 - Linux - Debian Bullseye
460 # Use larger ccache cache, as this task compiles with multiple compilers /
462 CCACHE_MAXSIZE: "1GB"
463 CCACHE_DIR: "/tmp/ccache_dir"
465 LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
467 # task that did not run, count as a success, so we need to recheck Linux'
469 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
472 image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest
479 ulimit -a -H && ulimit -a -S
488 # Test that code can be built with gcc/clang without warnings
491 setup_script: echo "COPT=-Werror" > src/Makefile.custom
493 # Trace probes have a history of getting accidentally broken. Use the
494 # different compilers to build with different combinations of dtrace on/off
495 # and cassert on/off.
497 # gcc, cassert off, dtrace on
499 gcc_warning_script: |
503 ${LINUX_CONFIGURE_FEATURES} \
504 CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
505 make -s -j${BUILD_JOBS} clean
506 time make -s -j${BUILD_JOBS} world-bin
508 # gcc, cassert on, dtrace off
510 gcc_a_warning_script: |
514 ${LINUX_CONFIGURE_FEATURES} \
515 CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
516 make -s -j${BUILD_JOBS} clean
517 time make -s -j${BUILD_JOBS} world-bin
519 # clang, cassert off, dtrace off
521 clang_warning_script: |
523 --cache clang.cache \
524 ${LINUX_CONFIGURE_FEATURES} \
525 CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
526 make -s -j${BUILD_JOBS} clean
527 time make -s -j${BUILD_JOBS} world-bin
529 # clang, cassert on, dtrace on
531 clang_a_warning_script: |
533 --cache clang.cache \
536 ${LINUX_CONFIGURE_FEATURES} \
537 CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
538 make -s -j${BUILD_JOBS} clean
539 time make -s -j${BUILD_JOBS} world-bin
541 # cross-compile to windows
543 mingw_cross_warning_script: |
545 --host=x86_64-w64-mingw32 \
547 CC="ccache x86_64-w64-mingw32-gcc" \
548 CXX="ccache x86_64-w64-mingw32-g++"
549 make -s -j${BUILD_JOBS} clean
550 time make -s -j${BUILD_JOBS} world-bin
553 # Verify docs can be built
555 # XXX: Only do this if there have been changes in doc/ since last build
563 make -s -j${BUILD_JOBS} clean
564 time make -s -j${BUILD_JOBS} -C doc
567 upload_caches: ccache