From 81f5e76049bc831f651e8e398eee17f0a9b9e26a Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 13 Nov 2022 16:32:41 -0600
Subject: [PATCH 11/11] cirrus: split linux and move the 'only_if:' line ..

..above the big 'env' blocks

This allows (for example) only running only tests under autoconf.
---
 .cirrus.yml | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 3473d792561..0a280f2cd71 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -61,6 +61,7 @@ on_failure_meson: &on_failure_meson
 
 task:
   name: FreeBSD - 13 - Meson
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
 
   env:
     CPUS: 4
@@ -71,8 +72,6 @@ task:
     CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST
     CFLAGS: -Og -ggdb
 
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
-
   compute_engine_instance:
     image_project: $IMAGE_PROJECT
     image: family/pg-ci-freebsd-13
@@ -173,8 +172,6 @@ task:
     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
 
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
-
   compute_engine_instance:
     image_project: $IMAGE_PROJECT
     image: family/pg-ci-bullseye
@@ -210,6 +207,7 @@ task:
 
   matrix:
     - name: Linux - Debian Bullseye - Autoconf
+      only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux-autoconf.*'
 
       configure_script: |
         su postgres <<-EOF
@@ -234,6 +232,7 @@ task:
         <<: *on_failure_ac
 
     - name: Linux - Debian Bullseye - Meson
+      only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux-meson.*'
 
       env:
         CCACHE_MAXSIZE: "2400M" # tests two different builds
@@ -300,6 +299,7 @@ task:
 
 task:
   name: macOS - Ventura - Meson
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
 
   env:
     CPUS: 4 # always get that much for cirrusci macOS instances
@@ -320,8 +320,6 @@ task:
     CFLAGS: -Og -ggdb
     CXXFLAGS: -Og -ggdb
 
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
-
   macos_instance:
     image: ghcr.io/cirruslabs/macos-ventura-base:latest
     #cpus: 4
@@ -409,6 +407,7 @@ task:
 
 task:
   name: Windows - Server 2019, VS 2019 - Meson
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
 
   env:
     # Half the allowed per-user CPU cores
@@ -435,8 +434,6 @@ task:
     # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
     CIRRUS_WINDOWS_ERROR_MODE: 0x8001
 
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
-
   windows_container:
     image: $CONTAINER_REPO/windows_ci_vs_2019:latest
     cpu: $CPUS
@@ -481,6 +478,9 @@ task:
 
 task:
   name: CompilerWarnings
+  # task that did not run, count as a success, so we need to recheck Linux'
+  # condition here ...
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
 
   # To limit unnecessary work only run this once the normal linux test succeeds
   depends_on:
@@ -500,10 +500,6 @@ task:
     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
     LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
 
-  # task that did not run, count as a success, so we need to recheck Linux'
-  # condition here ...
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
-
   container:
     image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest
     cpu: $CPUS
@@ -623,14 +619,13 @@ task:
 
 task:
   name: Documentation
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(docs|html).*'
+  skip: "!changesInclude('.cirrus.yml', 'doc/**')"
 
   env:
     CPUS: 1
     BUILD_JOBS: 1
 
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(docs|html).*'
-  skip: "!changesInclude('.cirrus.yml', 'doc/**')"
-
   container:
     image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest
     cpu: $CPUS
-- 
2.25.1

