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