Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postponed: Add MSVC setup to CI #210

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/demo-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,38 @@ 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: 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" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup this case. We are adding msys64 at the very last in the Path such that binaries like link.exe have a higher priority

} 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: |
$test_program=@'
#include<stdio.h>

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
Expand Down