@@ -3,27 +3,69 @@ on: [pull_request, push]
33permissions :
44 contents : read
55jobs :
6- build-windows :
7- runs-on : windows-latest
6+ build-and-test :
7+ strategy :
8+ matrix :
9+ include :
10+ - arch : x64
11+ runner : windows-latest
12+ vcvars_arch : x64
13+ - arch : x86
14+ runner : windows-latest
15+ vcvars_arch : x64_x86
16+ - arch : arm64
17+ runner : windows-11-arm
18+ vcvars_arch : arm64
19+ runs-on : ${{ matrix.runner }}
820 steps :
921 - uses : actions/checkout@v4
1022
11- - name : Setup MSVC
12- uses : ilammy/msvc-dev-cmd@v1
13-
14- - name : Compile
15- shell : pwsh
23+ - name : Compile for ${{ matrix.arch }}
24+ shell : cmd
1625 run : |
17- cl /O2 /std:c++20 /EHsc main.cpp /DUNICODE /D_UNICODE /Fe:win-witr.exe
18- # Add the current directory (where win-witr.exe was compiled) to PATH
19- $env:PATH = "$PWD;$env:PATH"
20-
21- # Verify the exe is accessible
22- Write-Host "Checking win-witr.exe availability..."
23- win-witr --version
24- - name : Run Tests
26+ REM Find vcvarsall.bat dynamically - check both possible vswhere.exe locations
27+ set "VSWHERE_LEGACY=C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
28+ set "VSWHERE_NATIVE=C:\Program Files\Microsoft Visual Studio\Installer\vswhere.exe"
29+
30+ if exist "%VSWHERE_LEGACY%" (
31+ set "VSWHERE_PATH=%VSWHERE_LEGACY%"
32+ ) else if exist "%VSWHERE_NATIVE%" (
33+ set "VSWHERE_PATH=%VSWHERE_NATIVE%"
34+ ) else (
35+ echo Error: vswhere.exe not found in either location.
36+ exit /b 1
37+ )
38+
39+ for /f "usebackq tokens=*" %%i in (`"%VSWHERE_PATH%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
40+ set "VS_PATH=%%i"
41+ )
42+
43+ if not exist "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" (
44+ echo Error: vcvarsall.bat not found.
45+ exit /b 1
46+ )
47+
48+ REM Initialize environment for the target architecture
49+ call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vcvars_arch }}
50+
51+ set outName=win-witr-${{ matrix.arch }}.exe
52+ echo Compiling %outName%...
53+ cl /O2 /GL /std:c++20 /EHsc main.cpp /DUNICODE /D_UNICODE /Fe:%outName%
54+ if errorlevel 1 exit /b 1
55+
56+ - name : Run Tests for ${{ matrix.arch }}
2557 shell : pwsh
2658 run : |
59+ # Add the current directory (where win-witr-${{ matrix.arch }}.exe was compiled) to PATH
60+ $env:PATH = "$PWD;$env:PATH"
61+
62+ # Copy the architecture-specific exe to the generic name for tests
63+ Copy-Item "win-witr-${{ matrix.arch }}.exe" "win-witr.exe"
64+
65+ # Verify the exe is accessible
66+ Write-Host "Checking win-witr.exe availability..."
67+ win-witr --version
68+
2769 # Run all test .bat files
2870 Get-ChildItem -Path tests -Recurse -Filter *.bat | ForEach-Object {
2971 Write-Host "Running test: $($_.FullName)"
0 commit comments