authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-22 13:38:05+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-22 13:38:05+01:00
logc8edfbe1d580fe3bfa0f95d0ec3a930cedce8711
tree9ad111a36c0199db00b705d29d868465dc4c2e56
parentfd3657bf8c3a2861e1b35cf36d469d342d853880
parent953ca759c2446adc21648a9017b656ac84171291

Merge pull request 'enable `x86_64-netbsd` CI' (#30889) from alexrp/zig:netbsd-ci into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30889

23 files changed, 173 insertions(+), 0 deletions(-)

.forgejo/workflows/ci.yaml+21
......@@ -197,6 +197,27 @@ jobs:
197197 run: sh ci/x86_64-linux-release.sh
198198 timeout-minutes: 360
199199
200 x86_64-netbsd-debug:
201 runs-on: [self-hosted, x86_64-netbsd]
202 steps:
203 - name: Checkout
204 uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
205 with:
206 fetch-depth: 0
207 - name: Build and Test
208 run: sh ci/x86_64-netbsd-debug.sh
209 timeout-minutes: 120
210 x86_64-netbsd-release:
211 runs-on: [self-hosted, x86_64-netbsd]
212 steps:
213 - name: Checkout
214 uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28
215 with:
216 fetch-depth: 0
217 - name: Build and Test
218 run: sh ci/x86_64-netbsd-release.sh
219 timeout-minutes: 120
220
200221 x86_64-openbsd-debug:
201222 runs-on: [self-hosted, x86_64-openbsd]
202223 steps:
ci/aarch64-linux-debug.sh+1
......@@ -47,6 +47,7 @@ stage3-debug/bin/zig build test docs \
4747 --maxrss ${ZSF_MAX_RSS:-0} \
4848 -Dstatic-llvm \
4949 -Dskip-non-native \
50 -Dskip-test-incremental \
5051 -Dtarget=native-native-musl \
5152 --search-prefix "$PREFIX" \
5253 --zig-lib-dir "$PWD/../lib" \
ci/aarch64-linux-release.sh+1
......@@ -47,6 +47,7 @@ stage3-release/bin/zig build test docs \
4747 --maxrss ${ZSF_MAX_RSS:-0} \
4848 -Dstatic-llvm \
4949 -Dskip-non-native \
50 -Dskip-test-incremental \
5051 -Dtarget=native-native-musl \
5152 --search-prefix "$PREFIX" \
5253 --zig-lib-dir "$PWD/../lib" \
ci/aarch64-macos-debug.sh+1
......@@ -47,6 +47,7 @@ stage3-debug/bin/zig build test docs \
4747 -Denable-macos-sdk \
4848 -Dstatic-llvm \
4949 -Dskip-non-native \
50 -Dskip-test-incremental \
5051 --search-prefix "$PREFIX" \
5152 --test-timeout 2m
5253
ci/aarch64-macos-release.sh+1
......@@ -46,6 +46,7 @@ stage3-release/bin/zig build test docs \
4646 -Denable-macos-sdk \
4747 -Dstatic-llvm \
4848 -Dskip-non-native \
49 -Dskip-test-incremental \
4950 --search-prefix "$PREFIX" \
5051 --test-timeout 2m
5152
ci/aarch64-windows.ps1+1
......@@ -60,6 +60,7 @@ Write-Output "Main test suite..."
6060 --search-prefix "$PREFIX_PATH" `
6161 -Dstatic-llvm `
6262 -Dskip-non-native `
63 -Dskip-test-incremental `
6364 -Denable-symlinks-windows `
6465 --test-timeout 30m
6566CheckLastExitCode
ci/loongarch64-linux-debug.sh+1
......@@ -48,6 +48,7 @@ stage3-debug/bin/zig build test docs \
4848 --maxrss ${ZSF_MAX_RSS:-0} \
4949 -Dstatic-llvm \
5050 -Dskip-non-native \
51 -Dskip-test-incremental \
5152 -Dtarget=native-native-musl \
5253 --search-prefix "$PREFIX" \
5354 --zig-lib-dir "$PWD/../lib" \
ci/loongarch64-linux-release.sh+1
......@@ -48,6 +48,7 @@ stage3-release/bin/zig build test docs \
4848 --maxrss ${ZSF_MAX_RSS:-0} \
4949 -Dstatic-llvm \
5050 -Dskip-non-native \
51 -Dskip-test-incremental \
5152 -Dtarget=native-native-musl \
5253 --search-prefix "$PREFIX" \
5354 --zig-lib-dir "$PWD/../lib" \
ci/powerpc64le-linux-debug.sh+1
......@@ -48,6 +48,7 @@ stage3-debug/bin/zig build test docs \
4848 --maxrss ${ZSF_MAX_RSS:-0} \
4949 -Dstatic-llvm \
5050 -Dskip-non-native \
51 -Dskip-test-incremental \
5152 -Dtarget=native-native-musl \
5253 -Dcpu=native+longcall \
5354 --search-prefix "$PREFIX" \
ci/powerpc64le-linux-release.sh+1
......@@ -48,6 +48,7 @@ stage3-release/bin/zig build test docs \
4848 --maxrss ${ZSF_MAX_RSS:-0} \
4949 -Dstatic-llvm \
5050 -Dskip-non-native \
51 -Dskip-test-incremental \
5152 -Dtarget=native-native-musl \
5253 -Dcpu=native+longcall \
5354 --search-prefix "$PREFIX" \
ci/s390x-linux-debug.sh+1
......@@ -48,6 +48,7 @@ stage3-debug/bin/zig build test docs \
4848 --maxrss ${ZSF_MAX_RSS:-0} \
4949 -Dstatic-llvm \
5050 -Dskip-non-native \
51 -Dskip-test-incremental \
5152 -Dtarget=native-native-musl \
5253 --search-prefix "$PREFIX" \
5354 --zig-lib-dir "$PWD/../lib" \
ci/s390x-linux-release.sh+1
......@@ -48,6 +48,7 @@ stage3-release/bin/zig build test docs \
4848 --maxrss ${ZSF_MAX_RSS:-0} \
4949 -Dstatic-llvm \
5050 -Dskip-non-native \
51 -Dskip-test-incremental \
5152 -Dtarget=native-native-musl \
5253 --search-prefix "$PREFIX" \
5354 --zig-lib-dir "$PWD/../lib" \
ci/x86_64-freebsd-debug.sh+1
......@@ -53,6 +53,7 @@ stage3-debug/bin/zig build test docs \
5353 -Dskip-openbsd \
5454 -Dskip-windows \
5555 -Dskip-darwin \
56 -Dskip-test-incremental \
5657 --search-prefix "$PREFIX" \
5758 --zig-lib-dir "$PWD/../lib" \
5859 --test-timeout 2m
ci/x86_64-freebsd-release.sh+1
......@@ -53,6 +53,7 @@ stage3-release/bin/zig build test docs \
5353 -Dskip-openbsd \
5454 -Dskip-windows \
5555 -Dskip-darwin \
56 -Dskip-test-incremental \
5657 --search-prefix "$PREFIX" \
5758 --zig-lib-dir "$PWD/../lib" \
5859 --test-timeout 2m
ci/x86_64-linux-debug-llvm.sh+1
......@@ -62,6 +62,7 @@ stage3-debug/bin/zig build test docs \
6262 -Dskip-openbsd \
6363 -Dskip-windows \
6464 -Dskip-darwin \
65 -Dskip-test-incremental \
6566 -Dtarget=native-native-musl \
6667 --search-prefix "$PREFIX" \
6768 --zig-lib-dir "$PWD/../lib" \
ci/x86_64-linux-debug.sh+1
......@@ -62,6 +62,7 @@ stage3-debug/bin/zig build test docs \
6262 -Dskip-windows \
6363 -Dskip-darwin \
6464 -Dskip-llvm \
65 -Dskip-test-incremental \
6566 -Dtarget=native-native-musl \
6667 --search-prefix "$PREFIX" \
6768 --zig-lib-dir "$PWD/../lib" \
ci/x86_64-linux-release.sh+1
......@@ -62,6 +62,7 @@ stage3-release/bin/zig build test docs \
6262 -fqemu \
6363 -fwasmtime \
6464 -Dstatic-llvm \
65 -Dskip-test-incremental \
6566 -Dtarget=native-native-musl \
6667 --search-prefix "$PREFIX" \
6768 --zig-lib-dir "$PWD/../lib" \
ci/x86_64-netbsd-debug.sh created+63
......@@ -0,0 +1,63 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8TARGET="x86_64-netbsd-none"
9MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
11PREFIX="$HOME/deps/$CACHE_BASENAME"
12ZIG="$PREFIX/bin/zig"
13
14# Override the cache directories because they won't actually help other CI runs
15# which will be testing alternate versions of zig, and ultimately would just
16# fill up space on the hard drive for no reason.
17export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
18export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
19
20mkdir build-debug
21cd build-debug
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26cmake .. \
27 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
28 -DCMAKE_PREFIX_PATH="$PREFIX" \
29 -DCMAKE_BUILD_TYPE=Debug \
30 -DZIG_TARGET_TRIPLE="$TARGET" \
31 -DZIG_TARGET_MCPU="$MCPU" \
32 -DZIG_STATIC=ON \
33 -DZIG_NO_LIB=ON \
34 -GNinja \
35 -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
36 -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
37# https://github.com/ziglang/zig/issues/22213
38
39# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
40# so that installation and testing do not get affected by them.
41unset CC
42unset CXX
43
44ninja install
45
46stage3-debug/bin/zig build test docs \
47 --maxrss ${ZSF_MAX_RSS:-0} \
48 -Dstatic-llvm \
49 -Dskip-non-native \
50 -Dskip-test-incremental \
51 --search-prefix "$PREFIX" \
52 --zig-lib-dir "$PWD/../lib" \
53 --test-timeout 2m
54
55stage3-debug/bin/zig build \
56 --prefix stage4-debug \
57 -Denable-llvm \
58 -Dno-lib \
59 -Dtarget=$TARGET \
60 -Duse-zig-libcxx \
61 -Dversion-string="$(stage3-debug/bin/zig version)"
62
63stage4-debug/bin/zig test ../test/behavior.zig
ci/x86_64-netbsd-release.sh created+69
......@@ -0,0 +1,69 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8TARGET="x86_64-netbsd-none"
9MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.2287+eb3f16db5"
11PREFIX="$HOME/deps/$CACHE_BASENAME"
12ZIG="$PREFIX/bin/zig"
13
14# Override the cache directories because they won't actually help other CI runs
15# which will be testing alternate versions of zig, and ultimately would just
16# fill up space on the hard drive for no reason.
17export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
18export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
19
20mkdir build-release
21cd build-release
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26cmake .. \
27 -DCMAKE_INSTALL_PREFIX="stage3-release" \
28 -DCMAKE_PREFIX_PATH="$PREFIX" \
29 -DCMAKE_BUILD_TYPE=Release \
30 -DZIG_TARGET_TRIPLE="$TARGET" \
31 -DZIG_TARGET_MCPU="$MCPU" \
32 -DZIG_STATIC=ON \
33 -DZIG_NO_LIB=ON \
34 -GNinja \
35 -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \
36 -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE
37# https://github.com/ziglang/zig/issues/22213
38
39# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
40# so that installation and testing do not get affected by them.
41unset CC
42unset CXX
43
44ninja install
45
46stage3-release/bin/zig build test docs \
47 --maxrss ${ZSF_MAX_RSS:-0} \
48 -Dstatic-llvm \
49 -Dskip-non-native \
50 -Dskip-test-incremental \
51 --search-prefix "$PREFIX" \
52 --zig-lib-dir "$PWD/../lib" \
53 --test-timeout 2m
54
55# Ensure that stage3 and stage4 are byte-for-byte identical.
56stage3-release/bin/zig build \
57 --prefix stage4-release \
58 -Denable-llvm \
59 -Dno-lib \
60 -Doptimize=ReleaseFast \
61 -Dstrip \
62 -Dtarget=$TARGET \
63 -Duse-zig-libcxx \
64 -Dversion-string="$(stage3-release/bin/zig version)"
65
66# diff returns an error code if the files differ.
67echo "If the following command fails, it means nondeterminism has been"
68echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
69diff stage3-release/bin/zig stage4-release/bin/zig
ci/x86_64-openbsd-debug.sh+1
......@@ -47,6 +47,7 @@ stage3-debug/bin/zig build test docs \
4747 --maxrss ${ZSF_MAX_RSS:-0} \
4848 -Dstatic-llvm \
4949 -Dskip-non-native \
50 -Dskip-test-incremental \
5051 --search-prefix "$PREFIX" \
5152 --zig-lib-dir "$PWD/../lib" \
5253 --test-timeout 2m
ci/x86_64-openbsd-release.sh+1
......@@ -47,6 +47,7 @@ stage3-release/bin/zig build test docs \
4747 --maxrss ${ZSF_MAX_RSS:-0} \
4848 -Dstatic-llvm \
4949 -Dskip-non-native \
50 -Dskip-test-incremental \
5051 --search-prefix "$PREFIX" \
5152 --zig-lib-dir "$PWD/../lib" \
5253 --test-timeout 2m
doc/langref/cImport_builtin.zig+1
......@@ -4,6 +4,7 @@ const c = @cImport({
44 @cInclude("stdio.h");
55});
66pub fn main() void {
7 if (@import("builtin").os.tag == .netbsd) return; // https://github.com/Vexu/arocc/issues/960
78 _ = c.printf("hello\n");
89}
910
doc/langref/verbose_cimport_flag.zig+1
......@@ -3,6 +3,7 @@ const c = @cImport({
33 @cInclude("stdio.h");
44});
55pub fn main() void {
6 if (@import("builtin").os.tag == .netbsd) return; // https://github.com/Vexu/arocc/issues/960
67 _ = c;
78}
89