CI: fix win32 MSVC setup and arm64 test

Replace hardcoded VsDevCmd.bat Enterprise path with vswhere.exe +
vcvarsall.bat for dynamic VS discovery across editions and runner
image versions.  Architecture args: amd64, x86, amd64_arm64.

Split x86_64/i386 win32 jobs into separate build and test steps.

For arm64: keep build+test in one step (needs vcvarsall for lib.exe).
Prepend standalone LLVM bin to PATH so clang targets ARM64 natively
instead of VS's clang-cl inheriting the x64-hosted cross-compile env.
This commit is contained in:
Meng Zhuo 2026-06-12 10:23:45 +08:00
parent 724b24eeb4
commit fb4077f2da

View File

@ -34,16 +34,16 @@ jobs:
timeout-minutes: 6 timeout-minutes: 6
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: build tcc (x86_64-win32)
shell: cmd
run: |
cd win32
for /f "delims=" %%i in ('vswhere.exe -latest -property installationPath') do call "%%i\VC\Auxiliary\Build\vcvarsall.bat" amd64
call build-tcc.bat -c cl -t x86_64
- name: test (x86_64-win32) - name: test (x86_64-win32)
shell: cmd shell: cmd
run: | run: |
echo ::group:: run build-tcc.bat cd tests
cd win32
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64
call build-tcc.bat -c cl -t x86_64
@echo off
echo ::endgroup::
cd ..\tests
call test-win32.bat all -k call test-win32.bat all -k
test-i386-win32: test-i386-win32:
@ -51,16 +51,16 @@ jobs:
timeout-minutes: 6 timeout-minutes: 6
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: build tcc (i386-win32)
shell: cmd
run: |
cd win32
for /f "delims=" %%i in ('vswhere.exe -latest -property installationPath') do call "%%i\VC\Auxiliary\Build\vcvarsall.bat" x86
call build-tcc.bat -c cl -t i386
- name: test (i386-win32) - name: test (i386-win32)
shell: cmd shell: cmd
run: | run: |
echo ::group:: run build-tcc.bat cd tests
cd win32
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x86
call build-tcc.bat -c cl -t i386
@echo off
echo ::endgroup::
cd ..\tests
call test-win32.bat -p c:\mingw32\bin all -k call test-win32.bat -p c:\mingw32\bin all -k
test-arm64-win32: test-arm64-win32:
@ -68,15 +68,13 @@ jobs:
timeout-minutes: 6 timeout-minutes: 6
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: test (arm64-win32) - name: build and test (arm64-win32)
shell: cmd shell: cmd
run: | run: |
echo ::group:: run build-tcc.bat
cd win32 cd win32
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=arm64 for /f "delims=" %%i in ('vswhere.exe -latest -property installationPath') do call "%%i\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64
call build-tcc.bat -c cl -t arm64 call build-tcc.bat -c cl -t arm64
@echo off set "PATH=C:\Program Files\LLVM\bin;%CD%;%PATH%"
echo ::endgroup::
cd ..\tests cd ..\tests
call test-win32.bat -c clang all -k call test-win32.bat -c clang all -k