From 88b06123ca09d4158f9db7d753782a17bd08d170 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Thu, 5 Nov 2026 10:28:55 +0300
Subject: [PATCH v15 7/8] ci: Upgrade GitHub Actions' runner OS versions

Use Ubuntu 26.04, macOS 26, and Windows Server 2025 as runner operating
sytems.

Update the MacPorts version to one providing a macOS 26 installer.
Locate Visual Studio with vswhere instead of assuming the installation
path, as new versions might provide different Visual Studio versions
(2026 in this case).

Suggested-by: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ1BcWBsWgCCk2GQkYN6tzDxCw2hVK2m3qeiwaNXUnjLVg%40mail.gmail.com
---
 .github/workflows/pg-ci.yml          | 21 +++++++++++++++------
 src/tools/ci/ci_macports_packages.sh |  2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/pg-ci.yml b/.github/workflows/pg-ci.yml
index 46fcbc7d1c1..0497e9f207f 100644
--- a/.github/workflows/pg-ci.yml
+++ b/.github/workflows/pg-ci.yml
@@ -202,9 +202,9 @@ jobs:
       # used centrally. We don't just want to use ubuntu-latest, as it's not
       # implausible there will be breakage when that switches to the next
       # ubuntu version.
-      runs_on_linux: ${{ case(vars.PG_CI_RUNS_ON_LINUX != '', vars.PG_CI_RUNS_ON_LINUX, 'ubuntu-24.04') }}
-      runs_on_windows: ${{ case(vars.PG_CI_RUNS_ON_WINDOWS != '', vars.PG_CI_RUNS_ON_WINDOWS, 'windows-2022') }}
-      runs_on_macos: ${{ case(vars.PG_CI_RUNS_ON_MACOS != '', vars.PG_CI_RUNS_ON_MACOS, 'macos-15') }}
+      runs_on_linux: ${{ case(vars.PG_CI_RUNS_ON_LINUX != '', vars.PG_CI_RUNS_ON_LINUX, 'ubuntu-26.04') }}
+      runs_on_windows: ${{ case(vars.PG_CI_RUNS_ON_WINDOWS != '', vars.PG_CI_RUNS_ON_WINDOWS, 'windows-2025') }}
+      runs_on_macos: ${{ case(vars.PG_CI_RUNS_ON_MACOS != '', vars.PG_CI_RUNS_ON_MACOS, 'macos-26') }}
       # runs_on_setup: an output can't be used as the input of the setup job
       # itself, so it's done inline below.
 
@@ -1032,9 +1032,18 @@ jobs:
         shell: pwsh
         run: src/tools/ci/gha_setup_windows_debugger.ps1
 
+      # The Visual Studio version and edition depend on the runner image.
+      - name: Locate Visual Studio
+        shell: pwsh
+        run: |
+          $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
+          $vs = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
+          if (!$? -or !$vs) { throw 'Could not locate Visual Studio C++ tools' }
+          Add-Content $env:GITHUB_ENV "VCVARSALL=$vs\VC\Auxiliary\Build\vcvarsall.bat"
+
       - name: Configure
         run: |
-          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
+          call "%VCVARSALL%" x64
           meson setup ^
             --backend ninja ^
             ${{env.MESON_COMMON_PG_CONFIG_ARGS}} ^
@@ -1046,7 +1055,7 @@ jobs:
 
       - name: Build
         run: |
-          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
+          call "%VCVARSALL%" x64
           ninja -C build ${{env.MBUILD_TARGET}} || exit 1
           ninja -C build -t missingdeps
 
@@ -1058,7 +1067,7 @@ jobs:
           # doesn't seem worth it.
           MTEST_TARGET: --slice ${{ matrix.slice}}/${{ matrix.num_slices}} ${{env.MTEST_TARGET}}
           ADDITIONAL_SETUP: |
-            call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
+            call "%VCVARSALL%" x64
         run: *meson_test_world_cmd
 
       - *upload_logs_step
diff --git a/src/tools/ci/ci_macports_packages.sh b/src/tools/ci/ci_macports_packages.sh
index 092d8cd7e8f..550a0221d1d 100755
--- a/src/tools/ci/ci_macports_packages.sh
+++ b/src/tools/ci/ci_macports_packages.sh
@@ -19,7 +19,7 @@ echo "macOS major version: $macos_major_version"
 # Scan the available MacPorts releases to find one that matches the running
 # macOS release.
 macports_release_list_url="https://api.github.com/repos/macports/macports-base/releases"
-macports_version_pattern="2\.10\.1"
+macports_version_pattern="2\.12\.7"
 # Authenticate the GitHub API request when a token is available (e.g. on
 # GitHub Actions). Unauthenticated requests share a 60/h/IP rate limit
 # with every other job on the runner's IP and frequently return an error
-- 
2.47.3

