From 0132dfeda493bca11150691ee1f74c59b949a35c Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Sat, 12 Nov 2022 15:33:12 +0100 Subject: [PATCH 1/6] Add MSVC setup to CI --- .github/workflows/demo-windows.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index e19140e7d..58d3b0f55 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -14,6 +14,33 @@ jobs: - name: Install mysys2 dependencies shell: powershell run: pacman -S --noconfirm unzip + - 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) + 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: | + $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: Show PATH shell: powershell run: Write-Host $env:path From d04a187027a487b4bf96050d36d8b5bf1cc05bd5 Mon Sep 17 00:00:00 2001 From: Max Ammann Date: Sat, 12 Nov 2022 15:57:23 +0100 Subject: [PATCH 2/6] Use cl without & --- .github/workflows/demo-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index 58d3b0f55..6e4729f56 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -40,7 +40,7 @@ jobs: } '@ Out-File -FilePath .\test_program.c -InputObject $test_program -Encoding utf8 - & cl .\test_program.c + cl .\test_program.c - name: Show PATH shell: powershell run: Write-Host $env:path From b4bff1ea1ad15d664fc24eab1b8b5ed778eb0207 Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Sat, 12 Nov 2022 16:06:34 +0100 Subject: [PATCH 3/6] Fix setting variables --- .github/workflows/demo-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index 6e4729f56..64f4bc29c 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -22,7 +22,7 @@ jobs: ForEach-Object { if ($_ -match "=") { $v = $_.split("=", 2) - echo "$v[0]=$v[1]" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + echo "$($v[0])=$($v[1])" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append } } Pop-Location From 8169958ddd0eb4fc275db4543b374278d3e7f4f5 Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Sat, 12 Nov 2022 16:06:34 +0100 Subject: [PATCH 4/6] Try to move msys2 back in the path variable --- .github/workflows/demo-windows.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index 64f4bc29c..b4c2a3a0a 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -8,12 +8,6 @@ jobs: name: Build runs-on: windows-2022 steps: - - name: Switch to msys2 - shell: powershell - run: echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Install mysys2 dependencies - shell: powershell - run: pacman -S --noconfirm unzip - name: Setup MSVC run: | $script=@' @@ -41,6 +35,12 @@ jobs: '@ Out-File -FilePath .\test_program.c -InputObject $test_program -Encoding utf8 cl .\test_program.c + - name: Switch to msys2 + shell: powershell + run: echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Install mysys2 dependencies + shell: powershell + run: pacman -S --noconfirm unzip - name: Show PATH shell: powershell run: Write-Host $env:path From f592b76318ad024f52580acc8de056205f485678 Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Sat, 12 Nov 2022 20:37:02 +0100 Subject: [PATCH 5/6] Try to set msys2 through GITHUB_ENV --- .github/workflows/demo-windows.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index b4c2a3a0a..52ca25f1e 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -16,7 +16,12 @@ jobs: ForEach-Object { if ($_ -match "=") { $v = $_.split("=", 2) - echo "$($v[0])=$($v[1])" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + + if ($($v[0]) -match "Path") { + echo "$($v[0])=$($v[1]);C:\msys64\usr\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 @@ -35,9 +40,6 @@ jobs: '@ Out-File -FilePath .\test_program.c -InputObject $test_program -Encoding utf8 cl .\test_program.c - - name: Switch to msys2 - shell: powershell - run: echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Install mysys2 dependencies shell: powershell run: pacman -S --noconfirm unzip From c390a9fbe4d450130c05ce8a76194540be016bd7 Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Sun, 13 Nov 2022 11:30:25 +0100 Subject: [PATCH 6/6] Show bash path --- .github/workflows/demo-windows.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index 52ca25f1e..8c4c0a3f9 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -43,9 +43,12 @@ jobs: - 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