Debian Codegraph @

.github/workflows/freebsd_build.yml

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