Skip to content

Commit

Permalink
ci: Test building from bootstrap.c without LLVM on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp committed Nov 23, 2024
1 parent 73dcd19 commit 7ab2602
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
28 changes: 20 additions & 8 deletions ci/x86_64-windows-debug.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ if ((git rev-parse --is-shallow-repository) -eq "true") {
git fetch --unshallow # `git describe` won't work on a shallow repo
}

Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
CheckLastExitCode

Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
-DevCmdArguments '-arch=x64 -no_logo' `
-StartInPath $(Get-Location)
CheckLastExitCode

# Test building from source without LLVM.
git clean -fd
Remove-Item -Path 'zig-out' -Recurse -Force -ErrorAction Ignore
cl -nologo bootstrap.c /link /OUT:bootstrap.exe
CheckLastExitCode
.\bootstrap
CheckLastExitCode
.\zig2 build -Dno-lib
CheckLastExitCode
.\zig-out\bin\zig test test\behavior.zig
CheckLastExitCode

Write-Output "Building from source..."
Remove-Item -Path 'build-debug' -Recurse -Force -ErrorAction Ignore
New-Item -Path 'build-debug' -ItemType Directory
Expand Down Expand Up @@ -94,14 +114,6 @@ CheckLastExitCode
-Mbuild_options="config.zig"
CheckLastExitCode

Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
CheckLastExitCode

Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
-DevCmdArguments '-arch=x64 -no_logo' `
-StartInPath $(Get-Location)
CheckLastExitCode

Write-Output "Build and run behavior tests with msvc..."
& cl.exe -I..\lib test-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /W3 /Z7 -link -nologo -debug -subsystem:console kernel32.lib ntdll.lib libcmt.lib
CheckLastExitCode
Expand Down
28 changes: 20 additions & 8 deletions ci/x86_64-windows-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ if ((git rev-parse --is-shallow-repository) -eq "true") {
git fetch --unshallow # `git describe` won't work on a shallow repo
}

Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
CheckLastExitCode

Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
-DevCmdArguments '-arch=x64 -no_logo' `
-StartInPath $(Get-Location)
CheckLastExitCode

# Test building from source without LLVM.
git clean -fd
Remove-Item -Path 'zig-out' -Recurse -Force -ErrorAction Ignore
cl -nologo bootstrap.c /link /OUT:bootstrap.exe
CheckLastExitCode
.\bootstrap
CheckLastExitCode
.\zig2 build -Dno-lib
CheckLastExitCode
.\zig-out\bin\zig test test\behavior.zig
CheckLastExitCode

Write-Output "Building from source..."
Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore
New-Item -Path 'build-release' -ItemType Directory
Expand Down Expand Up @@ -112,14 +132,6 @@ CheckLastExitCode
-Mbuild_options="config.zig"
CheckLastExitCode

Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
CheckLastExitCode

Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
-DevCmdArguments '-arch=x64 -no_logo' `
-StartInPath $(Get-Location)
CheckLastExitCode

Write-Output "Build and run behavior tests with msvc..."
& cl.exe -I..\lib test-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /W3 /Z7 -link -nologo -debug -subsystem:console kernel32.lib ntdll.lib libcmt.lib
CheckLastExitCode
Expand Down

0 comments on commit 7ab2602

Please sign in to comment.