Skip to content

Commit 5462881

Browse files
committed
Add NetBSD CI job
1 parent 5a8c486 commit 5462881

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

.github/workflows/cross-test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,39 @@ jobs:
135135
- name: iOS Simulator Runner
136136
timeout-minutes: 45
137137
run: /opt/homebrew/bin/bash tests/ci/run_ios_sim_tests.sh
138+
netbsd:
139+
runs-on: ${{ matrix.os }}
140+
name: Test NetBSD
141+
strategy:
142+
fail-fast: false
143+
matrix:
144+
include:
145+
- os: "ubuntu-latest"
146+
arch: "x86_64"
147+
- os: "ubuntu-24.04-arm"
148+
arch: "aarch64"
149+
steps:
150+
- uses: actions/checkout@v4
151+
- name: Test in NetBSD
152+
id: test
153+
uses: vmactions/netbsd-vm@v1
154+
with:
155+
release: "10.1"
156+
arch: ${{ matrix.arch }}
157+
envs: 'MYTOKEN MYTOKEN2'
158+
usesh: true
159+
run: |
160+
/usr/sbin/pkg_add cmake
161+
/usr/sbin/pkg_add gmake
162+
/usr/sbin/pkg_add go
163+
/usr/sbin/pkg_add ninja
164+
/usr/sbin/pkg_add perl
165+
export PATH="/usr/pkg/bin:/usr/pkg/sbin:/usr/sbin:/usr/bin:/sbin:/bin"
166+
curl -O https://dl.google.com/go/go1.25.2.netbsd-amd64.tar.gz
167+
mkdir -p /usr/local
168+
tar -C /usr/local -xzf go1.25.2.netbsd-amd64.tar.gz
169+
export GOROOT=/usr/local/go
170+
export PATH="$PATH:$GOROOT/bin"
171+
cmake . -B ./build -DCMAKE_BUILD_TYPE=Release -DDISABLE_GO=1 -GNinja
172+
cmake --build ./build -v --target all
173+
cmake --build ./build -v --target run_tests

tests/ci/common_posix_setup.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ PLATFORM=$(uname -m)
2424
NUM_CPU_THREADS=''
2525
KERNEL_NAME=$(uname -s)
2626
if [[ "${KERNEL_NAME}" == "Darwin" || "${KERNEL_NAME}" =~ .*BSD ]]; then
27-
# On MacOS, /proc/cpuinfo does not exist.
28-
NUM_CPU_THREADS=$(sysctl -n hw.ncpu)
27+
# sysctl is typically in /sbin or /usr/sbin on BSD systems
28+
if command -v sysctl &> /dev/null; then
29+
NUM_CPU_THREADS=$(sysctl -n hw.ncpu)
30+
elif [[ -x /sbin/sysctl ]]; then
31+
NUM_CPU_THREADS=$(/sbin/sysctl -n hw.ncpu)
32+
elif [[ -x /usr/sbin/sysctl ]]; then
33+
NUM_CPU_THREADS=$(/usr/sbin/sysctl -n hw.ncpu)
34+
else
35+
echo "Warning: Could not find sysctl, defaulting to 2 CPU threads"
36+
NUM
37+
fi
2938
else
3039
# Assume KERNEL_NAME is Linux.
3140
NUM_CPU_THREADS=$(grep -c ^processor /proc/cpuinfo)

0 commit comments

Comments
 (0)