Commit 71ccdb5a66

Jacob Young <jacobly0@users.noreply.github.com>
2024-04-14 05:12:52
ci: add self-hosted x86_64 windows
1 parent 425e38b
.github/workflows/ci.yaml
@@ -69,7 +69,7 @@ jobs:
       - name: Build and Test
         run: ci/aarch64-macos-release.sh
   x86_64-windows-debug:
-    runs-on: windows-latest
+    runs-on: [self-hosted, Windows, x86_64]
     env:
       ARCH: "x86_64"
     steps:
@@ -78,7 +78,7 @@ jobs:
       - name: Build and Test
         run: ci/x86_64-windows-debug.ps1
   x86_64-windows-release:
-    runs-on: windows-latest
+    runs-on: [self-hosted, Windows, x86_64]
     env:
       ARCH: "x86_64"
     steps:
ci/aarch64-linux-debug.sh
@@ -29,8 +29,8 @@ cd build-debug
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 cmake .. \
   -DCMAKE_INSTALL_PREFIX="stage3-debug" \
@@ -67,7 +67,7 @@ stage3-debug/bin/zig build test docs \
   -Dstatic-llvm \
   -Dtarget=native-native-musl \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 
 # Look for HTML errors.
 # TODO: move this to a build.zig flag (-Denable-tidy)
@@ -80,8 +80,8 @@ rm -rf ../build-new
 mkdir ../build-new
 cd ../build-new
 
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
 export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
 
@@ -105,5 +105,5 @@ stage3/bin/zig build -p stage4 \
   -Dtarget=native-native-musl \
   -Dno-lib \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 stage4/bin/zig test ../test/behavior.zig
ci/aarch64-linux-release.sh
@@ -29,8 +29,8 @@ cd build-release
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 cmake .. \
   -DCMAKE_INSTALL_PREFIX="stage3-release" \
@@ -67,7 +67,7 @@ stage3-release/bin/zig build test docs \
   -Dstatic-llvm \
   -Dtarget=native-native-musl \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 
 # Look for HTML errors.
 # TODO: move this to a build.zig flag (-Denable-tidy)
@@ -80,8 +80,8 @@ rm -rf ../build-new
 mkdir ../build-new
 cd ../build-new
 
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
 export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
 
@@ -105,5 +105,5 @@ stage3/bin/zig build -p stage4 \
   -Dtarget=native-native-musl \
   -Dno-lib \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 stage4/bin/zig test ../test/behavior.zig
ci/aarch64-macos-debug.sh
@@ -6,7 +6,7 @@ set -e
 # Script assumes the presence of the following:
 # s3cmd
 
-ZIGDIR="$(pwd)"
+ZIGDIR="$PWD"
 TARGET="$ARCH-macos-none"
 MCPU="baseline"
 CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
@@ -26,8 +26,8 @@ cd build
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 PATH="$HOME/local/bin:$PATH" cmake .. \
   -DCMAKE_INSTALL_PREFIX="stage3-debug" \
@@ -44,7 +44,7 @@ PATH="$HOME/local/bin:$PATH" cmake .. \
 $HOME/local/bin/ninja install
 
 stage3-debug/bin/zig build test docs \
-  --zig-lib-dir "$(pwd)/../lib" \
+  --zig-lib-dir "$PWD/../lib" \
   -Denable-macos-sdk \
   -Dstatic-llvm \
   -Dskip-non-native \
ci/aarch64-macos-release.sh
@@ -6,7 +6,7 @@ set -e
 # Script assumes the presence of the following:
 # s3cmd
 
-ZIGDIR="$(pwd)"
+ZIGDIR="$PWD"
 TARGET="$ARCH-macos-none"
 MCPU="baseline"
 CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
@@ -26,8 +26,8 @@ cd build
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 PATH="$HOME/local/bin:$PATH" cmake .. \
   -DCMAKE_INSTALL_PREFIX="stage3-release" \
@@ -44,7 +44,7 @@ PATH="$HOME/local/bin:$PATH" cmake .. \
 $HOME/local/bin/ninja install
 
 stage3-release/bin/zig build test docs \
-  --zig-lib-dir "$(pwd)/../lib" \
+  --zig-lib-dir "$PWD/../lib" \
   -Denable-macos-sdk \
   -Dstatic-llvm \
   -Dskip-non-native \
ci/x86_64-linux-debug.sh
@@ -37,8 +37,8 @@ cd build-debug
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 cmake .. \
   -DCMAKE_INSTALL_PREFIX="stage3-debug" \
@@ -75,7 +75,7 @@ stage3-debug/bin/zig build test docs \
   -Dstatic-llvm \
   -Dtarget=native-native-musl \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 
 # Look for HTML errors.
 # TODO: move this to a build.zig flag (-Denable-tidy)
@@ -88,8 +88,8 @@ rm -rf ../build-new
 mkdir ../build-new
 cd ../build-new
 
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
 export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
 
@@ -113,5 +113,5 @@ stage3/bin/zig build -p stage4 \
   -Dtarget=native-native-musl \
   -Dno-lib \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 stage4/bin/zig test ../test/behavior.zig
ci/x86_64-linux-release.sh
@@ -37,8 +37,8 @@ cd build-release
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 cmake .. \
   -DCMAKE_INSTALL_PREFIX="stage3-release" \
@@ -76,7 +76,7 @@ stage3-release/bin/zig build test docs \
   -Dstatic-llvm \
   -Dtarget=native-native-musl \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 
 # Look for HTML errors.
 # TODO: move this to a build.zig flag (-Denable-tidy)
@@ -105,8 +105,8 @@ rm -rf ../build-new
 mkdir ../build-new
 cd ../build-new
 
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
 export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
 
@@ -130,5 +130,5 @@ stage3/bin/zig build -p stage4 \
   -Dtarget=native-native-musl \
   -Dno-lib \
   --search-prefix "$PREFIX" \
-  --zig-lib-dir "$(pwd)/../lib"
+  --zig-lib-dir "$PWD/../lib"
 stage4/bin/zig test ../test/behavior.zig
ci/x86_64-macos-release.sh
@@ -3,7 +3,7 @@
 set -x
 set -e
 
-ZIGDIR="$(pwd)"
+ZIGDIR="$PWD"
 TARGET="$ARCH-macos-none"
 MCPU="baseline"
 CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
@@ -40,8 +40,8 @@ cd build
 # Override the cache directories because they won't actually help other CI runs
 # which will be testing alternate versions of zig, and ultimately would just
 # fill up space on the hard drive for no reason.
-export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
-export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
+export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
+export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
 
 cmake .. \
   -DCMAKE_PREFIX_PATH="$PREFIX" \
@@ -56,7 +56,7 @@ cmake .. \
 make $JOBS install
 
 stage3/bin/zig build test docs \
-  --zig-lib-dir "$(pwd)/../lib" \
+  --zig-lib-dir "$PWD/../lib" \
   -Denable-macos-sdk \
   -Dstatic-llvm \
   -Dskip-non-native \
ci/x86_64-windows-debug.ps1
@@ -1,19 +1,10 @@
 $TARGET = "$($Env:ARCH)-windows-gnu"
 $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
 $MCPU = "baseline"
-$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
-$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
+$PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
 $ZIG = "$PREFIX_PATH\bin\zig.exe"
 $ZIG_LIB_DIR = "$(Get-Location)\lib"
 
-choco install ninja
-Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
-Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
-
-Write-Output "Extracting..."
-Add-Type -AssemblyName System.IO.Compression.FileSystem ;
-[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
-
 function CheckLastExitCode {
     if (!$?) {
         exit 1
@@ -43,6 +34,8 @@ Set-Location -Path 'build-debug'
   -DCMAKE_BUILD_TYPE=Debug `
   -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
   -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
+  -DCMAKE_AR="$($ZIG -Replace "\\", "/")" `
+  -DZIG_AR_WORKAROUND=ON `
   -DZIG_TARGET_TRIPLE="$TARGET" `
   -DZIG_TARGET_MCPU="$MCPU" `
   -DZIG_STATIC=ON `
@@ -85,10 +78,10 @@ CheckLastExitCode
   --mod build_options config.zig
 CheckLastExitCode
 
-Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
+Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
 CheckLastExitCode
 
-Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" `
+Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
   -DevCmdArguments '-arch=x64 -no_logo' `
   -StartInPath $(Get-Location)
 CheckLastExitCode
ci/x86_64-windows-release.ps1
@@ -1,19 +1,10 @@
 $TARGET = "$($Env:ARCH)-windows-gnu"
 $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
 $MCPU = "baseline"
-$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
-$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
+$PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
 $ZIG = "$PREFIX_PATH\bin\zig.exe"
 $ZIG_LIB_DIR = "$(Get-Location)\lib"
 
-choco install ninja
-Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
-Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
-
-Write-Output "Extracting..."
-Add-Type -AssemblyName System.IO.Compression.FileSystem ;
-[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
-
 function CheckLastExitCode {
     if (!$?) {
         exit 1
@@ -43,6 +34,8 @@ Set-Location -Path 'build-release'
   -DCMAKE_BUILD_TYPE=Release `
   -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
   -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
+  -DCMAKE_AR="$($ZIG -Replace "\\", "/")" `
+  -DZIG_AR_WORKAROUND=ON `
   -DZIG_TARGET_TRIPLE="$TARGET" `
   -DZIG_TARGET_MCPU="$MCPU" `
   -DZIG_STATIC=ON `
@@ -84,10 +77,10 @@ CheckLastExitCode
   --mod build_options config.zig
 CheckLastExitCode
 
-Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
+Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
 CheckLastExitCode
 
-Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" `
+Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
   -DevCmdArguments '-arch=x64 -no_logo' `
   -StartInPath $(Get-Location)
 CheckLastExitCode