From 6f0f801e9e0b24682a537b78c9da4afcd25cdc41 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Thu, 4 Sep 2025 17:20:18 +0300
Subject: [PATCH v3 2/2] ci: windows: Default to VS 2022, run VS 2019 task
 manually

Both VS 2019 and VS 2022 are available on the Windows image [1], but
since VS 2022 is the latest version, make it the default. The VS 2019
task is still available but must be triggered manually.

[1] https://github.com/anarazel/pg-vm-images/pull/116

Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/flat/CAN55FZ1OsaM+852BMQDJ+Kgfg+07knJ6dM3PjbGbtYaK4qwfqA@mail.gmail.com
---
 .cirrus.star      |  3 ++-
 .cirrus.tasks.yml | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/.cirrus.star b/.cirrus.star
index e9bb672b959..cecd9bb026c 100644
--- a/.cirrus.star
+++ b/.cirrus.star
@@ -73,7 +73,7 @@ def compute_environment_vars():
     # REPO_CI_AUTOMATIC_TRIGGER_TASKS="task_name other_task" under "Repository
     # Settings" on Cirrus CI's website.
 
-    default_manual_trigger_tasks = ['mingw', 'netbsd', 'openbsd']
+    default_manual_trigger_tasks = ['mingw', 'netbsd', 'openbsd', 'vs2019']
 
     repo_ci_automatic_trigger_tasks = env.get('REPO_CI_AUTOMATIC_TRIGGER_TASKS', '')
     for task in default_manual_trigger_tasks:
@@ -103,6 +103,7 @@ def compute_environment_vars():
       'netbsd',
       'openbsd',
       'sanitycheck',
+      'vs2019',
       'windows',
     ]
     commit_message = env.get('CIRRUS_CHANGE_MESSAGE')
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 12236569c13..1c947874ae2 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -752,7 +752,6 @@ WINDOWS_ENVIRONMENT_BASE: &WINDOWS_ENVIRONMENT_BASE
 
 
 task:
-  name: Windows - Server 2022, VS 2019 - Meson & ninja
   << : *WINDOWS_ENVIRONMENT_BASE
 
   env:
@@ -775,10 +774,21 @@ task:
       -Dplperl=enabled
       -Dplpython=enabled
 
+  matrix:
+    - name: Windows - Server 2022, VS 2022 - Meson & ninja
+      env:
+        # Use VS 2022
+        PATH: C:\VS_2022\VC\Auxiliary\Build;${PATH}
+      only_if: $CI_WINDOWS_ENABLED
+
+    # VS 2019 is the default VS installation
+    - name: Windows - Server 2022, VS 2019 - Meson & ninja
+      trigger_type: $CI_TRIGGER_TYPE_VS2019
+      only_if: $CI_VS2019_ENABLED
+
   <<: *windows_task_template
 
   depends_on: SanityCheck
-  only_if: $CI_WINDOWS_ENABLED
 
   setup_additional_packages_script: |
     REM choco install -y --no-progress ...
-- 
2.51.0

