Skip to content

MILAB-6205: activate vcvars on Windows runners in node-matrix workflows#177

Merged
xnacly merged 7 commits into
v4-betafrom
MILAB-6205_msvc-dev-cmd-on-node-matrix
Jun 3, 2026
Merged

MILAB-6205: activate vcvars on Windows runners in node-matrix workflows#177
xnacly merged 7 commits into
v4-betafrom
MILAB-6205_msvc-dev-cmd-on-node-matrix

Conversation

@xnacly
Copy link
Copy Markdown
Member

@xnacly xnacly commented Jun 3, 2026

Add a Setup MSVC Dev Cmd step (using the shared setup-msvc-dev-cmd action) to the prebuild job in both reusable matrix workflows so that any downstream consumer building a C / C++ extension from source on Windows finds cl.exe and the SDK headers automatically.

What's added

- 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' }}

Inserted between "Install pipx" and "Configure ccache" in:

  • .github/workflows/node-matrix.yaml
  • .github/workflows/node-matrix-pnpm.yaml

No-op on Linux and macOS runners (the if: runner.os == 'Windows' guard). On Windows runners it activates VS 2022 Build Tools via vcvarsall (the underlying ilammy/msvc-dev-cmd action) and exports the resulting env (INCLUDE / LIB / LIBPATH / PATH plus DISTUTILS_USE_SDK=1) to subsequent steps.

Why

The windows-latest runner ships VS 2022 Build Tools but doesn't activate them by default. Any subsequent build step that compiles a C extension (e.g. pip wheel against a setuptools/distutils sdist) fails with:

error: Microsoft Visual C++ 14.0 or greater is required.
Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

This was surfaced by the runenv-python-3 PR #88 (freesasa addition) where the freesasa sdist's plain setup.py path couldn't find cl.exe. The original attempt rolled MSVC activation inside the runenv builder; once this PR merges and the v4 tag advances, that code is removed and runenv-python-3 just lists freesasa in deps + buildWheel.

Pattern mirrors the existing usage in milaboratory/pframes-rs, which already activates MSVC via this same shared action.

Blast radius

  • runner.os == 'Windows' guard means non-Windows matrix cells skip the step entirely.
  • Adds ~3 seconds to Windows prebuild jobs (vswhere lookup + env capture).
  • Activates VS env vars unconditionally on Windows. Steps that previously relied on default GitHub Actions Windows env (no MSVC activation) will now see MSVC env. For cmake-based builds that pin their own toolchain (e.g. kalign-python via clang-cl + Ninja in runenv-python-3 clustering), cmake's toolchain discovery overrides the env anyway, so no behavioural change.
  • For setuptools-based builds that previously fell back to system tools / failed silently, the activation enables them to succeed.

Verification

Local YAML syntax checked; the matrix.arch expression matches what both reusable workflows pass through (amd64 / arm64). Real verification is downstream PRs picking up the updated @v4 ref.

Greptile Summary

Adds a Setup MSVC Dev Cmd step (wrapping ilammy/msvc-dev-cmd) to the prebuild job in both node-matrix.yaml and node-matrix-pnpm.yaml, guarded by if: runner.os == 'Windows', so that downstream Windows build steps that compile C/C++ extensions from source can find cl.exe and the SDK headers automatically.

  • node-matrix.yaml and node-matrix-pnpm.yaml: The new step is inserted between the pipx install steps and the ccache configuration step, in the correct position to export MSVC env vars (INCLUDE, LIB, PATH, DISTUTILS_USE_SDK=1) before any compilation happens.
  • The underlying setup-msvc-dev-cmd shared action pins ilammy/msvc-dev-cmd to a specific commit SHA, which is good practice for supply-chain safety.

Confidence Score: 5/5

Safe to merge — the change is additive, well-guarded, and follows an existing pattern in the monorepo.

Both files receive an identical, minimal addition: a single step behind runner.os == Windows that activates the VS 2022 developer environment. The underlying shared action pins ilammy/msvc-dev-cmd to a specific commit SHA. The arch expression correctly collapses to arm64 or amd64. Non-Windows matrix cells are completely unaffected, and the step's position (after pipx, before ccache) is the right order for MSVC env vars to be visible to subsequent compilation steps.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/node-matrix.yaml Adds a Windows-only MSVC activation step in the prebuild job between pipx setup and ccache configuration; guard and arch expression are both correct.
.github/workflows/node-matrix-pnpm.yaml Identical MSVC activation step added to the pnpm variant's prebuild job; same correct guard and arch expression as node-matrix.yaml.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[checkout] --> B[Install pipx\nLinux / macOS]
    B --> C{runner.os == Windows?}
    C -- Yes --> D[Setup MSVC Dev Cmd\nilammy/msvc-dev-cmd\narch: arm64 or amd64]
    C -- No --> E[Skip MSVC setup]
    D --> F{inputs.enable-ccache?}
    E --> F
    F -- Yes --> G[Configure ccache]
    F -- No --> H[Cache additional paths]
    G --> H
    H --> I[Load milab-shell-utils]
    I --> J[node/test or pnpm build]
Loading

Reviews (1): Last reviewed commit: "MILAB-6205: activate vcvars on Windows r..." | Re-trigger Greptile

PaulNewling and others added 7 commits May 29, 2026 10:12
Section 2b required a changeset for every workspace package consuming a
bumped catalog key, scanning all dependency sections. That flagged
packages whose only "change" was a build-tool catalog bump in a
devDependency (e.g. @platforma-sdk/block-tools in a block model,
@platforma-sdk/tengo-builder in a workflow) even though the package's own
files were untouched and `pnpm changeset` does not flag them.

Restrict the catalog-consumer scan to runtime sections (dependencies,
peerDependencies). A runtime catalog dep bump still requires a release;
build-only tooling no longer produces false positives.

Adds a bats case + pkg-dev fixture covering the devDependency path.
pl-compose: set static --master-secret for htpasswd auth
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`).
@notion-workspace
Copy link
Copy Markdown

@DenKoren
Copy link
Copy Markdown
Member

DenKoren commented Jun 3, 2026

nit: better to first merge to v4-beta, then use merge-beta script.

@xnacly xnacly changed the base branch from v4 to v4-beta June 3, 2026 13:44
@xnacly xnacly merged commit ad32053 into v4-beta Jun 3, 2026
1 check passed
xnacly added a commit to platforma-open/runenv-python-3 that referenced this pull request Jun 3, 2026
milaboratory/github-ci#177 added a `Setup MSVC Dev Cmd` step to the
node-matrix reusable workflows and was merged to v4-beta. The
v4-beta -> v4 promotion (milaboratory/github-ci#178) is still open,
so a build referencing `@v4` still hits the old workflow without
MSVC activation.

Per the team's convention (branch from v4-beta, experiment in
v4-beta, validate downstream against v4-beta, then merge v4-beta
to v4 and revert downstream pin), switch the reusable workflow
reference to `@v4-beta` for the duration of this PR. Will be
reverted to `@v4` once #178 merges.

`context/init@v4` reference is left untouched, the action is
unchanged on v4 (only the reusable workflow YAML was modified).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants