Debian Codegraph @

.github/workflows/netbsd_build.yml

raw
1 name: NetBSD Build
2 permissions:
3 contents: read
4
5 on:
6 workflow_dispatch:
7 inputs:
8 netbsd_version:
9 description: 'NetBSD version to use'
10 required: false
11 default: '10.0'
12 type: choice
13 options:
14 - '10.0'
15 - '9.4'
16 - '9.3'
17 lua_version:
18 description: 'Lua version to use'
19 required: false
20 default: 'lua54'
21 type: choice
22 options:
23 - 'luajit'
24 - 'lua51'
25 - 'lua53'
26 - 'lua54'
27
28 jobs:
29 netbsd-build:
30 runs-on: ubuntu-latest
31 name: Build on NetBSD ${{ inputs.netbsd_version }} with ${{ inputs.lua_version }}
32
33 steps:
34 - name: Check out source code
35 uses: actions/checkout@v4
36
37 - name: Build on NetBSD
38 uses: vmactions/netbsd-vm@v1
39 with:
40 release: ${{ inputs.netbsd_version }}
41 usesh: true
42 prepare: |
43 # Set up package repository
44 export PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r)/All"
45 echo "PKG_PATH=${PKG_PATH}"
46
47 # Install pkgin for easier package management
48 /usr/sbin/pkg_add -v pkgin || true
49
50 # Update package database
51 pkgin -y update || /usr/sbin/pkg_add -v pkgin
52
53 # Install base build dependencies
54 pkgin -y install cmake ninja-build pkgconf \
55 pcre2 sqlite3 openssl ragel icu \
56 libsodium glib2 libunwind \
57 perl libarchive zstd xxhash \
58 file || true
59
60 # Install Lua version based on user selection
61 case "${{ inputs.lua_version }}" in
62 luajit)
63 pkgin -y install luajit || true
64 ;;
65 lua51)
66 pkgin -y install lua51 || true
67 ;;
68 lua53)
69 pkgin -y install lua53 || true
70 ;;
71 lua54)
72 pkgin -y install lua54 || true
73 ;;
74 esac
75
76 run: |
77 set -e
78
79 echo "==> Building Rspamd on NetBSD $(uname -r) with ${{ inputs.lua_version }}"
80
81 # Determine Lua CMake flags
82 case "${{ inputs.lua_version }}" in
83 luajit)
84 LUA_FLAGS="-DENABLE_LUAJIT=ON"
85 ;;
86 *)
87 LUA_FLAGS="-DENABLE_LUAJIT=OFF"
88 ;;
89 esac
90
91 # Create build directory
92 mkdir -p build
93 cd build
94
95 # Run CMake
96 echo "==> Running CMake configuration"
97 cmake -G Ninja \
98 -DCMAKE_BUILD_TYPE=Release \
99 -DCMAKE_INSTALL_PREFIX=/usr/local \
100 -DENABLE_HYPERSCAN=OFF \
101 $LUA_FLAGS \
102 -DSYSTEM_ZSTD=ON \
103 -DSYSTEM_XXHASH=ON \
104 ..
105
106 # Build
107 echo "==> Building Rspamd"
108 ninja
109
110 # Run tests
111 echo "==> Running C++ unit tests"
112 ./test/rspamd-test-cxx || echo "C++ tests failed"
113
114 echo "==> Running Lua unit tests"
115 ./test/rspamd-test -p /rspamd/lua || echo "Lua tests failed"
116
117 echo "==> Build completed successfully!"