Skip to content

ci: use setup-msvc-dev action instead of a hard-coded vcvars path#817

Merged
Youw merged 3 commits into
masterfrom
fix-windows-ci-vcvars
Jun 14, 2026
Merged

ci: use setup-msvc-dev action instead of a hard-coded vcvars path#817
Youw merged 3 commits into
masterfrom
fix-windows-ci-vcvars

Conversation

@Youw

@Youw Youw commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

The windows-cmake job set up the MSVC environment by call-ing a hard-coded path:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat

in its NMake MSVC, NMake clang-cl and Meson steps. The hosted windows-latest image no longer has Visual Studio under that Enterprise path, so as of recently every one of those steps fails at the first call:

The system cannot find the path specified.

(windows-msbuild is unaffected — it doesn't call vcvars.)

This sets up the MSVC developer environment once per job with the setup-msvc-dev action — it locates the installed toolchain via vswhere (no hard-coded path or VS edition) — and removes all seven vcvars64.bat calls.

Since that environment is job-wide, the MinGW build (which must use gcc, not cl) is split out into its own windows-mingw job that runs without the MSVC environment. The MSVC, NMake, clang-cl and Meson builds stay in windows-cmake with the action.

Assisted-by: claude-code:claude-opus-4-8

@Youw Youw force-pushed the fix-windows-ci-vcvars branch from 282f756 to 4865fec Compare June 14, 2026 08:21
@Youw

Youw commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

Heads-up: #813 also fixes this same Windows CI break in builds.yml, via a different mechanism — it adds a vswhere-based step that exports VCVARS_PATH and replaces the hard-coded path with call "%VCVARS_PATH%". This PR instead drops the manual vcvars calls entirely and sets the environment up once per job with the setup-msvc-dev action.

So the two overlap on builds.yml: whichever merges first, the other's builds.yml change should be dropped on rebase. #813's other changes (the linux/hid.c memory-leak fix and the IWYU header cleanups) are unrelated to CI and unaffected.

(Note: #813 also touches mac/hid.c, which overlaps #816 — worth coordinating that rebase too.)

Drafted with Claude Code.

The windows-cmake job set up the MSVC environment by calling a hard-coded
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
in its NMake, clang-cl and Meson steps. The hosted windows-latest image no
longer has Visual Studio under that "Enterprise" path, so those steps started
failing with "The system cannot find the path specified."

Set up the developer environment once per job with the
TheMrMilchmann/setup-msvc-dev action -- it locates the installed toolchain (no
hard-coded path or edition) -- and drop all the hard-coded vcvars64.bat calls.

That environment is job-wide, so the MinGW build (which must use gcc, not cl)
is split out into its own windows-mingw job that runs without the MSVC
environment. The MSVC, NMake, clang-cl and Meson builds stay in windows-cmake
with the action.

Assisted-by: claude-code:claude-opus-4-8
@Youw Youw force-pushed the fix-windows-ci-vcvars branch from 4865fec to 8d8b73a Compare June 14, 2026 09:29
@mcuee mcuee added the build system/CI Anything related to building the project or running on CI label Jun 14, 2026
Comment thread .github/workflows/builds.yml Outdated
Comment thread .github/workflows/builds.yml Outdated
Co-authored-by: Ihor Dutchak <ihor.youw@gmail.com>
@Youw Youw merged commit 2514836 into master Jun 14, 2026
24 of 25 checks passed
@Youw Youw deleted the fix-windows-ci-vcvars branch June 14, 2026 10:41
Youw added a commit to JHartzer/hidapi that referenced this pull request Jun 14, 2026
Resolve the builds.yml conflict in favour of master: the hard-coded vcvars
path is now fixed on master by the setup-msvc-dev action plus a dedicated
windows-mingw job (libusb#817), so this branch's vswhere-based CI change is dropped
as redundant. The static-analysis code changes (the linux/hid.c memory-leak
fix and the IWYU header cleanups) are unaffected.

Assisted-by: claude-code:claude-opus-4-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build system/CI Anything related to building the project or running on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants