@@ -55,6 +55,78 @@ on_failure_meson: &on_failure_meson
5555type :text/plain
5656
5757
58+ # To avoid unnecessarily spinning up a lot of VMs / containers for entirely
59+ # broken commits, have a minimal task that all others depend on.
60+ task :
61+ name :SanityCheck
62+
63+ # If a specific OS is requested, don't run the sanity check. This shortens
64+ # push-wait-for-ci cycle time a bit when debugging operating system specific
65+ # failures. Uses skip instead of only_if, as cirrus otherwise warns about
66+ # only_if conditions not matching.
67+ skip :$CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*'
68+
69+ env :
70+ CPUS :4
71+ BUILD_JOBS :8
72+ TEST_JOBS :8
73+ CCACHE_DIR :${CIRRUS_WORKING_DIR}/ccache_dir
74+ # no options enabled, should be small
75+ CCACHE_MAXSIZE :" 150M"
76+
77+ # Container starts up quickly, but is slower at runtime, particularly for
78+ # tests. Good for the briefly running sanity check.
79+ container :
80+ image :$CONTAINER_REPO/linux_debian_bullseye_ci:latest
81+ cpu :$CPUS
82+
83+ ccache_cache :
84+ folder :$CCACHE_DIR
85+
86+ create_user_script :|
87+ useradd -m postgres
88+ chown -R postgres:postgres .
89+ mkdir -p ${CCACHE_DIR}
90+ chown -R postgres:postgres ${CCACHE_DIR}
91+ echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
92+ su postgres -c "ulimit -l -H && ulimit -l -S"
93+ # Can't change container's kernel.core_pattern. Postgres user can't write
94+ # to / normally. Change that.
95+ chown root:postgres /
96+ chmod g+rwx /
97+
98+ configure_script :|
99+ su postgres <<-EOF
100+ meson setup \
101+ --buildtype=debug \
102+ --auto-features=disabled \
103+ -Dtap_tests=enabled \
104+ build
105+ EOF
106+ build_script :|
107+ su postgres <<-EOF
108+ ninja -C build -j${BUILD_JOBS}
109+ EOF
110+ upload_caches :ccache
111+
112+ # Run a minimal set of tests. The main regression tests take too long for
113+ # this purpose. For now this is a random quick pg_regress style test, and a
114+ # tap test that exercises both a frontend binary and the backend.
115+ test_minimal_script :|
116+ su postgres <<-EOF
117+ ulimit -c unlimited
118+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS} \
119+ tmp_install cube/regress pg_ctl/001_start_stop
120+ EOF
121+
122+ on_failure :
123+ << :*on_failure_meson
124+ cores_script :|
125+ mkdir -m 770 /tmp/cores
126+ find / -maxdepth 1 -type f -name 'core*' -exec mv '{}' /tmp/cores/ \;
127+ src/tools/ci/cores_backtrace.sh linux /tmp/cores
128+
129+
58130task :
59131name :FreeBSD - 13 - Meson
60132
69141CPPFLAGS :-DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST
70142CFLAGS :-Og -ggdb
71143
144+ depends_on :SanityCheck
72145only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
73146
74147compute_engine_instance :
@@ -170,6 +243,7 @@ task:
170243LINUX_CONFIGURE_FEATURES :*LINUX_CONFIGURE_FEATURES
171244LINUX_MESON_FEATURES :*LINUX_MESON_FEATURES
172245
246+ depends_on :SanityCheck
173247only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
174248
175249compute_engine_instance :
@@ -311,6 +385,7 @@ task:
311385CFLAGS :-Og -ggdb
312386CXXFLAGS :-Og -ggdb
313387
388+ depends_on :SanityCheck
314389only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
315390
316391osx_instance :
@@ -430,6 +505,7 @@ task:
430505# 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
431506CIRRUS_WINDOWS_ERROR_MODE :0x8001
432507
508+ depends_on :SanityCheck
433509only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
434510
435511windows_container :
@@ -469,6 +545,8 @@ task:
469545# worth using only_if despite being manual, otherwise this task will show up
470546# when e.g. ci-os-only: linux is used.
471547only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*mingw.*'
548+ # otherwise it'll be sorted before other tasks
549+ depends_on :SanityCheck
472550
473551windows_container :
474552image :$CONTAINER_REPO/windows_ci_mingw64:latest
@@ -523,9 +601,12 @@ task:
523601task :
524602name :CompilerWarnings
525603
526- # To limit unnecessary work only run this once the normal linux test succeeds
527- depends_on :
528- -Linux - Debian Bullseye - Meson
604+ # To limit unnecessary work only run this once the SanityCheck
605+ # succeeds. This is particularly important for this task as we intentionally
606+ # use always: to continue after failures. Task that did not run count as a
607+ # success, so we need to recheck SanityChecks's condition here ...
608+ depends_on :SanityCheck
609+ only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*'
529610
530611env :
531612CPUS :4
@@ -539,10 +620,6 @@ task:
539620LINUX_CONFIGURE_FEATURES :*LINUX_CONFIGURE_FEATURES
540621LINUX_MESON_FEATURES :*LINUX_MESON_FEATURES
541622
542- # task that did not run, count as a success, so we need to recheck Linux'
543- # condition here ...
544- only_if :$CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
545-
546623container :
547624image :$CONTAINER_REPO/linux_debian_bullseye_ci:latest
548625cpu :$CPUS