From 0d42b9caebc5e7e6f311697f18c10745e6f05d58 Mon Sep 17 00:00:00 2001 From: xnacly <47723417+xnacly@users.noreply.github.com> Date: Wed, 3 Jun 2026 15:19:00 +0200 Subject: [PATCH] MILAB-6205: activate vcvars on Windows runners in node-matrix workflows Add a `Setup MSVC Dev Cmd` step (a thin wrapper around `ilammy/msvc-dev-cmd` via the shared `setup-msvc-dev-cmd` action) to the prebuild job's step list on both reusable workflows: - node-matrix.yaml - node-matrix-pnpm.yaml Gated by `if: runner.os == 'Windows'`, so it is a no-op on Linux and macOS runners. Background: the runenv-python-3 repo's freesasa addition (PR #88) exposed that the prebuild matrix on Windows ships VS 2022 Build Tools but never activates them in the job shell. setuptools' distutils therefore fails to find `cl.exe` when `pip wheel` compiles a C extension from sdist, even though the headers and linker libs are on disk. Running the vcvars activation here means every downstream consumer of these reusable workflows gets a ready-to-build Windows env without having to roll their own activation (the runenv-python-3 PR initially did this in the builder; that code is now reverted in favour of this). The action also exports `DISTUTILS_USE_SDK=1`, which tells setuptools' MSVC compiler shim to skip its own VS lookup and trust the env vars already in scope (`INCLUDE` / `LIB` / `LIBPATH` / `PATH`). `arch` is mapped from the matrix's `amd64` / `arm64` values to vcvarsall's expected `amd64` / `arm64` args. Pattern mirrors the existing usage in milaboratory/pframes-rs (`.github/actions/setup-agent/action.yml`). --- .github/workflows/node-matrix-pnpm.yaml | 12 ++++++++++++ .github/workflows/node-matrix.yaml | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/node-matrix-pnpm.yaml b/.github/workflows/node-matrix-pnpm.yaml index 248e241a..62ed186d 100644 --- a/.github/workflows/node-matrix-pnpm.yaml +++ b/.github/workflows/node-matrix-pnpm.yaml @@ -648,6 +648,18 @@ jobs: brew install pipx pipx ensurepath + # Activate vcvars on Windows runners so any subsequent step that + # builds a C / C++ extension from source (e.g. `pip wheel` against + # a setuptools/distutils sdist) finds `cl.exe` and the SDK headers. + # The action also sets `DISTUTILS_USE_SDK=1`, which tells + # setuptools' MSVC compiler shim to skip its own VS lookup. No-op + # on non-Windows runners. + - name: Setup MSVC Dev Cmd + if: runner.os == 'Windows' + uses: milaboratory/github-ci/actions/setup-msvc-dev-cmd@v4 + with: + arch: ${{ matrix.arch == 'arm64' && 'arm64' || 'amd64' }} + - name: Configure ccache if: inputs.enable-ccache uses: milaboratory/github-ci/actions/ccache@v4 diff --git a/.github/workflows/node-matrix.yaml b/.github/workflows/node-matrix.yaml index 0e6d8cfa..6373f289 100644 --- a/.github/workflows/node-matrix.yaml +++ b/.github/workflows/node-matrix.yaml @@ -487,6 +487,18 @@ jobs: r-version: ${{ inputs.r-version }} # cache-version: ${{ inputs.cache-version }} + # Activate vcvars on Windows runners so any subsequent step that + # builds a C / C++ extension from source (e.g. `pip wheel` against + # a setuptools/distutils sdist) finds `cl.exe` and the SDK headers. + # The action also sets `DISTUTILS_USE_SDK=1`, which tells + # setuptools' MSVC compiler shim to skip its own VS lookup. No-op + # on non-Windows runners. + - name: Setup MSVC Dev Cmd + if: runner.os == 'Windows' + uses: milaboratory/github-ci/actions/setup-msvc-dev-cmd@v4 + with: + arch: ${{ matrix.arch == 'arm64' && 'arm64' || 'amd64' }} + - name: Configure ccache if: inputs.enable-ccache uses: milaboratory/github-ci/actions/ccache@v4