Skip to content

Commit 544397c

Browse files
authored
Merge pull request #19649 from ziglang/x86_64-windows-ci
ci: add self-hosted `x86_64 windows`
2 parents 130fb5c + 71ccdb5 commit 544397c

14 files changed

+332
-315
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Build and Test
7070
run: ci/aarch64-macos-release.sh
7171
x86_64-windows-debug:
72-
runs-on: windows-latest
72+
runs-on: [self-hosted, Windows, x86_64]
7373
env:
7474
ARCH: "x86_64"
7575
steps:
@@ -78,7 +78,7 @@ jobs:
7878
- name: Build and Test
7979
run: ci/x86_64-windows-debug.ps1
8080
x86_64-windows-release:
81-
runs-on: windows-latest
81+
runs-on: [self-hosted, Windows, x86_64]
8282
env:
8383
ARCH: "x86_64"
8484
steps:

ci/aarch64-linux-debug.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ cd build-debug
2929
# Override the cache directories because they won't actually help other CI runs
3030
# which will be testing alternate versions of zig, and ultimately would just
3131
# fill up space on the hard drive for no reason.
32-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
33-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
32+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
33+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
3434

3535
cmake .. \
3636
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
@@ -67,7 +67,7 @@ stage3-debug/bin/zig build test docs \
6767
-Dstatic-llvm \
6868
-Dtarget=native-native-musl \
6969
--search-prefix "$PREFIX" \
70-
--zig-lib-dir "$(pwd)/../lib"
70+
--zig-lib-dir "$PWD/../lib"
7171

7272
# Look for HTML errors.
7373
# TODO: move this to a build.zig flag (-Denable-tidy)
@@ -80,8 +80,8 @@ rm -rf ../build-new
8080
mkdir ../build-new
8181
cd ../build-new
8282

83-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
84-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
83+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
84+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
8585
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
8686
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
8787

@@ -105,5 +105,5 @@ stage3/bin/zig build -p stage4 \
105105
-Dtarget=native-native-musl \
106106
-Dno-lib \
107107
--search-prefix "$PREFIX" \
108-
--zig-lib-dir "$(pwd)/../lib"
108+
--zig-lib-dir "$PWD/../lib"
109109
stage4/bin/zig test ../test/behavior.zig

ci/aarch64-linux-release.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ cd build-release
2929
# Override the cache directories because they won't actually help other CI runs
3030
# which will be testing alternate versions of zig, and ultimately would just
3131
# fill up space on the hard drive for no reason.
32-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
33-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
32+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
33+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
3434

3535
cmake .. \
3636
-DCMAKE_INSTALL_PREFIX="stage3-release" \
@@ -67,7 +67,7 @@ stage3-release/bin/zig build test docs \
6767
-Dstatic-llvm \
6868
-Dtarget=native-native-musl \
6969
--search-prefix "$PREFIX" \
70-
--zig-lib-dir "$(pwd)/../lib"
70+
--zig-lib-dir "$PWD/../lib"
7171

7272
# Look for HTML errors.
7373
# TODO: move this to a build.zig flag (-Denable-tidy)
@@ -80,8 +80,8 @@ rm -rf ../build-new
8080
mkdir ../build-new
8181
cd ../build-new
8282

83-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
84-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
83+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
84+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
8585
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
8686
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
8787

@@ -105,5 +105,5 @@ stage3/bin/zig build -p stage4 \
105105
-Dtarget=native-native-musl \
106106
-Dno-lib \
107107
--search-prefix "$PREFIX" \
108-
--zig-lib-dir "$(pwd)/../lib"
108+
--zig-lib-dir "$PWD/../lib"
109109
stage4/bin/zig test ../test/behavior.zig

ci/aarch64-macos-debug.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
# Script assumes the presence of the following:
77
# s3cmd
88

9-
ZIGDIR="$(pwd)"
9+
ZIGDIR="$PWD"
1010
TARGET="$ARCH-macos-none"
1111
MCPU="baseline"
1212
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
@@ -26,8 +26,8 @@ cd build
2626
# Override the cache directories because they won't actually help other CI runs
2727
# which will be testing alternate versions of zig, and ultimately would just
2828
# fill up space on the hard drive for no reason.
29-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
30-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
29+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
30+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
3131

3232
PATH="$HOME/local/bin:$PATH" cmake .. \
3333
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
@@ -44,7 +44,7 @@ PATH="$HOME/local/bin:$PATH" cmake .. \
4444
$HOME/local/bin/ninja install
4545

4646
stage3-debug/bin/zig build test docs \
47-
--zig-lib-dir "$(pwd)/../lib" \
47+
--zig-lib-dir "$PWD/../lib" \
4848
-Denable-macos-sdk \
4949
-Dstatic-llvm \
5050
-Dskip-non-native \

ci/aarch64-macos-release.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
# Script assumes the presence of the following:
77
# s3cmd
88

9-
ZIGDIR="$(pwd)"
9+
ZIGDIR="$PWD"
1010
TARGET="$ARCH-macos-none"
1111
MCPU="baseline"
1212
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
@@ -26,8 +26,8 @@ cd build
2626
# Override the cache directories because they won't actually help other CI runs
2727
# which will be testing alternate versions of zig, and ultimately would just
2828
# fill up space on the hard drive for no reason.
29-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
30-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
29+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
30+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
3131

3232
PATH="$HOME/local/bin:$PATH" cmake .. \
3333
-DCMAKE_INSTALL_PREFIX="stage3-release" \
@@ -44,7 +44,7 @@ PATH="$HOME/local/bin:$PATH" cmake .. \
4444
$HOME/local/bin/ninja install
4545

4646
stage3-release/bin/zig build test docs \
47-
--zig-lib-dir "$(pwd)/../lib" \
47+
--zig-lib-dir "$PWD/../lib" \
4848
-Denable-macos-sdk \
4949
-Dstatic-llvm \
5050
-Dskip-non-native \

ci/x86_64-linux-debug.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ cd build-debug
3737
# Override the cache directories because they won't actually help other CI runs
3838
# which will be testing alternate versions of zig, and ultimately would just
3939
# fill up space on the hard drive for no reason.
40-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
41-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
40+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
41+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
4242

4343
cmake .. \
4444
-DCMAKE_INSTALL_PREFIX="stage3-debug" \
@@ -75,7 +75,7 @@ stage3-debug/bin/zig build test docs \
7575
-Dstatic-llvm \
7676
-Dtarget=native-native-musl \
7777
--search-prefix "$PREFIX" \
78-
--zig-lib-dir "$(pwd)/../lib"
78+
--zig-lib-dir "$PWD/../lib"
7979

8080
# Look for HTML errors.
8181
# TODO: move this to a build.zig flag (-Denable-tidy)
@@ -88,8 +88,8 @@ rm -rf ../build-new
8888
mkdir ../build-new
8989
cd ../build-new
9090

91-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
92-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
91+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
92+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
9393
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
9494
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
9595

@@ -113,5 +113,5 @@ stage3/bin/zig build -p stage4 \
113113
-Dtarget=native-native-musl \
114114
-Dno-lib \
115115
--search-prefix "$PREFIX" \
116-
--zig-lib-dir "$(pwd)/../lib"
116+
--zig-lib-dir "$PWD/../lib"
117117
stage4/bin/zig test ../test/behavior.zig

ci/x86_64-linux-release.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ cd build-release
3737
# Override the cache directories because they won't actually help other CI runs
3838
# which will be testing alternate versions of zig, and ultimately would just
3939
# fill up space on the hard drive for no reason.
40-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
41-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
40+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
41+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
4242

4343
cmake .. \
4444
-DCMAKE_INSTALL_PREFIX="stage3-release" \
@@ -76,7 +76,7 @@ stage3-release/bin/zig build test docs \
7676
-Dstatic-llvm \
7777
-Dtarget=native-native-musl \
7878
--search-prefix "$PREFIX" \
79-
--zig-lib-dir "$(pwd)/../lib"
79+
--zig-lib-dir "$PWD/../lib"
8080

8181
# Look for HTML errors.
8282
# TODO: move this to a build.zig flag (-Denable-tidy)
@@ -105,8 +105,8 @@ rm -rf ../build-new
105105
mkdir ../build-new
106106
cd ../build-new
107107

108-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
109-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
108+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
109+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
110110
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
111111
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
112112

@@ -130,5 +130,5 @@ stage3/bin/zig build -p stage4 \
130130
-Dtarget=native-native-musl \
131131
-Dno-lib \
132132
--search-prefix "$PREFIX" \
133-
--zig-lib-dir "$(pwd)/../lib"
133+
--zig-lib-dir "$PWD/../lib"
134134
stage4/bin/zig test ../test/behavior.zig

ci/x86_64-macos-release.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -x
44
set -e
55

6-
ZIGDIR="$(pwd)"
6+
ZIGDIR="$PWD"
77
TARGET="$ARCH-macos-none"
88
MCPU="baseline"
99
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.12.0-dev.467+0345d7866"
@@ -40,8 +40,8 @@ cd build
4040
# Override the cache directories because they won't actually help other CI runs
4141
# which will be testing alternate versions of zig, and ultimately would just
4242
# fill up space on the hard drive for no reason.
43-
export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-global-cache"
44-
export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-local-cache"
43+
export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
44+
export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
4545

4646
cmake .. \
4747
-DCMAKE_PREFIX_PATH="$PREFIX" \
@@ -56,7 +56,7 @@ cmake .. \
5656
make $JOBS install
5757

5858
stage3/bin/zig build test docs \
59-
--zig-lib-dir "$(pwd)/../lib" \
59+
--zig-lib-dir "$PWD/../lib" \
6060
-Denable-macos-sdk \
6161
-Dstatic-llvm \
6262
-Dskip-non-native \

ci/x86_64-windows-debug.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
$TARGET = "$($Env:ARCH)-windows-gnu"
22
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
33
$MCPU = "baseline"
4-
$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
5-
$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
4+
$PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
65
$ZIG = "$PREFIX_PATH\bin\zig.exe"
76
$ZIG_LIB_DIR = "$(Get-Location)\lib"
87

9-
choco install ninja
10-
Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
11-
Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
12-
13-
Write-Output "Extracting..."
14-
Add-Type -AssemblyName System.IO.Compression.FileSystem ;
15-
[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
16-
178
function CheckLastExitCode {
189
if (!$?) {
1910
exit 1
@@ -43,6 +34,8 @@ Set-Location -Path 'build-debug'
4334
-DCMAKE_BUILD_TYPE=Debug `
4435
-DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
4536
-DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
37+
-DCMAKE_AR="$($ZIG -Replace "\\", "/")" `
38+
-DZIG_AR_WORKAROUND=ON `
4639
-DZIG_TARGET_TRIPLE="$TARGET" `
4740
-DZIG_TARGET_MCPU="$MCPU" `
4841
-DZIG_STATIC=ON `
@@ -85,10 +78,10 @@ CheckLastExitCode
8578
--mod build_options config.zig
8679
CheckLastExitCode
8780

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

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

ci/x86_64-windows-release.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
$TARGET = "$($Env:ARCH)-windows-gnu"
22
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
33
$MCPU = "baseline"
4-
$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
5-
$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
4+
$PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
65
$ZIG = "$PREFIX_PATH\bin\zig.exe"
76
$ZIG_LIB_DIR = "$(Get-Location)\lib"
87

9-
choco install ninja
10-
Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
11-
Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
12-
13-
Write-Output "Extracting..."
14-
Add-Type -AssemblyName System.IO.Compression.FileSystem ;
15-
[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
16-
178
function CheckLastExitCode {
189
if (!$?) {
1910
exit 1
@@ -43,6 +34,8 @@ Set-Location -Path 'build-release'
4334
-DCMAKE_BUILD_TYPE=Release `
4435
-DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
4536
-DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
37+
-DCMAKE_AR="$($ZIG -Replace "\\", "/")" `
38+
-DZIG_AR_WORKAROUND=ON `
4639
-DZIG_TARGET_TRIPLE="$TARGET" `
4740
-DZIG_TARGET_MCPU="$MCPU" `
4841
-DZIG_STATIC=ON `
@@ -84,10 +77,10 @@ CheckLastExitCode
8477
--mod build_options config.zig
8578
CheckLastExitCode
8679

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

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

0 commit comments

Comments
 (0)