diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index ecddb5d17..1f4f920c4 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -8,17 +8,47 @@ jobs: name: Build runs-on: windows-2022 steps: - - name: Switch to msys2 - shell: powershell + - name: Setup MSVC + run: | + $script=@' + Push-Location "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build" + & "C:\Windows\System32\cmd.exe" /c "vcvars64.bat & set" | + ForEach-Object { + if ($_ -match "=") { + $v = $_.split("=", 2) + + if ($($v[0]) -match "Path") { + echo "$($v[0])=$($v[1]);C:\msys64\usr\bin;C:\msys64\mingw64\bin" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + } else { + echo "$($v[0])=$($v[1])" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + } + } + } + Pop-Location + '@ + Out-File -FilePath .\msvc.ps1 -InputObject $script -Encoding utf8 + & .\msvc.ps1 + - name: Test MSVC run: | - echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + $test_program=@' + #include + + int main() { + printf("Hello World\n"); + return 0; + } + '@ + Out-File -FilePath .\test_program.c -InputObject $test_program -Encoding utf8 + cl .\test_program.c - name: Install mysys2 dependencies shell: powershell run: pacman -S --noconfirm unzip - - name: Show PATH + - name: Show Powershell PATH shell: powershell run: Write-Host $env:path + - name: Show bash PATH + shell: powershell + run: bash -c 'echo $PATH' - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup