From 9f47d7fbb44b68e9d03e25389c4d109aa7baa5f6 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 25 Aug 2026 15:20:01 +0800 Subject: [PATCH] CI: Use setup-msvc-dev action instead of hardcoding the VS install path The Windows runner image upgrade moved Visual Studio from "...\2022\Enterprise\..." to "...\18\Enterprise\...", breaking the hardcoded vcvars64.bat path (see PR #4860). Use the TheMrMilchmann/setup-msvc-dev action instead, which locates the VS installation dynamically via vswhere and exports the environment to later steps, so future runner image upgrades don't require another hardcoded-path fix. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci_tests_dev.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index 71666672337..9a46e59563f 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -105,8 +105,14 @@ jobs: path: 'gmt' persist-credentials: false - # Build GMT from source on Linux/macOS, script is adapted from - # https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh + - name: Set up MSVC environment (Windows) + if: runner.os == 'Windows' + uses: TheMrMilchmann/setup-msvc-dev@368ef7d1ee4d1171b31d4a7f67f4d954f903f5a9 # v4.1.0 + with: + arch: x64 + + # Build GMT from source. + # Script is adapted from https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh - name: Build GMT from source shell: bash run: | @@ -114,7 +120,6 @@ jobs: mkdir build cd build if [[ "$RUNNER_OS" == "Windows" ]]; then - cmd.exe /c "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" CMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt/Library" else CMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt"