@@ -55,6 +55,78 @@ on_failure_meson: &on_failure_meson
5555 type : 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 :
59131 name : FreeBSD - 13 - Meson
60132
69141 CPPFLAGS : -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST
70142 CFLAGS : -Og -ggdb
71143
144+ depends_on : SanityCheck
72145 only_if : $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
73146
74147 compute_engine_instance :
@@ -170,6 +243,7 @@ task:
170243 LINUX_CONFIGURE_FEATURES : *LINUX_CONFIGURE_FEATURES
171244 LINUX_MESON_FEATURES : *LINUX_MESON_FEATURES
172245
246+ depends_on : SanityCheck
173247 only_if : $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
174248
175249 compute_engine_instance :
@@ -311,6 +385,7 @@ task:
311385 CFLAGS : -Og -ggdb
312386 CXXFLAGS : -Og -ggdb
313387
388+ depends_on : SanityCheck
314389 only_if : $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
315390
316391 osx_instance :
@@ -430,6 +505,7 @@ task:
430505 # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
431506 CIRRUS_WINDOWS_ERROR_MODE : 0x8001
432507
508+ depends_on : SanityCheck
433509 only_if : $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
434510
435511 windows_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.
471547 only_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
473551 windows_container :
474552 image : $CONTAINER_REPO/windows_ci_mingw64:latest
@@ -523,9 +601,12 @@ task:
523601task :
524602 name : 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
530611 env :
531612 CPUS : 4
@@ -539,10 +620,6 @@ task:
539620 LINUX_CONFIGURE_FEATURES : *LINUX_CONFIGURE_FEATURES
540621 LINUX_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-
546623 container :
547624 image : $CONTAINER_REPO/linux_debian_bullseye_ci:latest
548625 cpu : $CPUS
0 commit comments