From: Vsevolod Stakhov Date: Tue, 4 Nov 2025 12:01:10 +0000 (+0000) Subject: [Feature] Add/improve BSD build workflows with Lua version selection X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52d2b4e6cfefca0c1813e68cca4b9e5280a963a2;p=thirdparty%2Frspamd.git [Feature] Add/improve BSD build workflows with Lua version selection Add comprehensive GitHub Actions workflows for BSD systems with the ability to select Lua version (LuaJIT, Lua 5.1, 5.3, 5.4). NetBSD workflow improvements: - Add Lua version selection (luajit, lua51, lua53, lua54) - Fix missing dependencies (libarchive, zstd, xxhash, file) - Remove || true from pkg_add to catch installation failures - Add -DENABLE_HYPERSCAN=OFF (not available on NetBSD) - Add -DSYSTEM_ZSTD=ON and -DSYSTEM_XXHASH=ON flags - Add conditional ENABLE_LUAJIT based on Lua version selection - Add NetBSD 9.4 to supported versions - Fix test executable paths (add ./ prefix) New FreeBSD workflow: - Support FreeBSD 14.2, 13.4, 13.3 - Lua version selection (luajit, lua51, lua53, lua54) - Full dependency list including hyperscan - Enable hyperscan support (-DENABLE_HYPERSCAN=ON) - Use system zstd and xxhash libraries - Proper pkg update before installation New OpenBSD workflow: - Support OpenBSD 7.6, 7.5, 7.4 - Lua version selection (luajit, lua51, lua53) - Full dependency list including hyperscan - Enable hyperscan support - Disable jemalloc (-DENABLE_JEMALLOC=OFF) - Use OpenBSD-specific package names (icu4c, perl-5, lua%5.x) - Use system zstd and xxhash libraries All workflows: - Use workflow_dispatch trigger for manual execution - Allow selection of OS version and Lua version - Use vmactions VMs for BSD testing - Run both C++ and Lua unit tests - Use Ninja build system for faster compilation This provides comprehensive testing across different BSD platforms and Lua versions, ensuring Rspamd builds correctly on various configurations. --- diff --git a/.github/workflows/freebsd_build.yml b/.github/workflows/freebsd_build.yml new file mode 100644 index 0000000000..6d4dfad7e1 --- /dev/null +++ b/.github/workflows/freebsd_build.yml @@ -0,0 +1,110 @@ +name: FreeBSD Build +permissions: + contents: read + +on: + workflow_dispatch: + inputs: + freebsd_version: + description: 'FreeBSD version to use' + required: false + default: '14.2' + type: choice + options: + - '14.2' + - '13.4' + - '13.3' + lua_version: + description: 'Lua version to use' + required: false + default: 'luajit' + type: choice + options: + - 'luajit' + - 'lua51' + - 'lua53' + - 'lua54' + +jobs: + freebsd-build: + runs-on: ubuntu-latest + name: Build on FreeBSD ${{ inputs.freebsd_version }} with ${{ inputs.lua_version }} + + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Build on FreeBSD + uses: vmactions/freebsd-vm@v1 + with: + release: ${{ inputs.freebsd_version }} + usesh: true + prepare: | + # Update package repository + pkg update -f + + # Install base build dependencies + pkg install -y cmake ninja pkgconf \ + pcre2 sqlite3 openssl ragel icu \ + libsodium glib libunwind \ + perl5 libarchive libzstd xxhash \ + hyperscan file ca_root_nss + + # Install Lua version based on user selection + case "${{ inputs.lua_version }}" in + luajit) + pkg install -y luajit + ;; + lua51) + pkg install -y lua51 + ;; + lua53) + pkg install -y lua53 + ;; + lua54) + pkg install -y lua54 + ;; + esac + + run: | + set -e + + echo "==> Building Rspamd on FreeBSD $(freebsd-version) with ${{ inputs.lua_version }}" + + # Determine Lua CMake flags + case "${{ inputs.lua_version }}" in + luajit) + LUA_FLAGS="-DENABLE_LUAJIT=ON" + ;; + *) + LUA_FLAGS="-DENABLE_LUAJIT=OFF" + ;; + esac + + # Create build directory + mkdir -p build + cd build + + # Run CMake + echo "==> Running CMake configuration" + cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DENABLE_HYPERSCAN=ON \ + $LUA_FLAGS \ + -DSYSTEM_ZSTD=ON \ + -DSYSTEM_XXHASH=ON \ + .. + + # Build + echo "==> Building Rspamd" + ninja -j$(sysctl -n hw.ncpu) + + # Run tests + echo "==> Running C++ unit tests" + ./test/rspamd-test-cxx || echo "C++ tests failed" + + echo "==> Running Lua unit tests" + ./test/rspamd-test -p /rspamd/lua || echo "Lua tests failed" + + echo "==> Build completed successfully!" diff --git a/.github/workflows/netbsd_build.yml b/.github/workflows/netbsd_build.yml index 1fbb4fc11b..59a5c48975 100644 --- a/.github/workflows/netbsd_build.yml +++ b/.github/workflows/netbsd_build.yml @@ -12,13 +12,24 @@ on: type: choice options: - '10.0' + - '9.4' - '9.3' + lua_version: + description: 'Lua version to use' + required: false + default: 'lua54' + type: choice + options: + - 'luajit' + - 'lua51' + - 'lua53' + - 'lua54' jobs: netbsd-build: runs-on: ubuntu-latest - name: Build on NetBSD ${{ inputs.netbsd_version }} - + name: Build on NetBSD ${{ inputs.netbsd_version }} with ${{ inputs.lua_version }} + steps: - name: Check out source code uses: actions/checkout@v4 @@ -32,35 +43,65 @@ jobs: # Install base build dependencies pkg_add cmake ninja-build pkgconf \ pcre2 sqlite3 openssl ragel icu \ - libsodium glib2 libunwind luajit \ - perl5 || true - # Note: hyperscan may not be available on all NetBSD versions + libsodium glib2 libunwind \ + perl5 libarchive zstd xxhash \ + file + + # Install Lua version based on user selection + case "${{ inputs.lua_version }}" in + luajit) + pkg_add luajit + ;; + lua51) + pkg_add lua51 + ;; + lua53) + pkg_add lua53 + ;; + lua54) + pkg_add lua54 + ;; + esac + run: | set -e - - echo "==> Building Rspamd on NetBSD $(uname -r)" - + + echo "==> Building Rspamd on NetBSD $(uname -r) with ${{ inputs.lua_version }}" + + # Determine Lua CMake flags + case "${{ inputs.lua_version }}" in + luajit) + LUA_FLAGS="-DENABLE_LUAJIT=ON" + ;; + *) + LUA_FLAGS="-DENABLE_LUAJIT=OFF" + ;; + esac + # Create build directory mkdir -p build cd build - + # Run CMake echo "==> Running CMake configuration" cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DENABLE_LUAJIT=ON \ + -DENABLE_HYPERSCAN=OFF \ + $LUA_FLAGS \ + -DSYSTEM_ZSTD=ON \ + -DSYSTEM_XXHASH=ON \ .. - + # Build echo "==> Building Rspamd" ninja -j$(sysctl -n hw.ncpu) - + # Run tests echo "==> Running C++ unit tests" - test/rspamd-test-cxx || echo "C++ tests failed" - + ./test/rspamd-test-cxx || echo "C++ tests failed" + echo "==> Running Lua unit tests" - test/rspamd-test -p /rspamd/lua || echo "Lua tests failed" - + ./test/rspamd-test -p /rspamd/lua || echo "Lua tests failed" + echo "==> Build completed successfully!" diff --git a/.github/workflows/openbsd_build.yml b/.github/workflows/openbsd_build.yml new file mode 100644 index 0000000000..0de4c4752a --- /dev/null +++ b/.github/workflows/openbsd_build.yml @@ -0,0 +1,104 @@ +name: OpenBSD Build +permissions: + contents: read + +on: + workflow_dispatch: + inputs: + openbsd_version: + description: 'OpenBSD version to use' + required: false + default: '7.6' + type: choice + options: + - '7.6' + - '7.5' + - '7.4' + lua_version: + description: 'Lua version to use' + required: false + default: 'luajit' + type: choice + options: + - 'luajit' + - 'lua51' + - 'lua53' + +jobs: + openbsd-build: + runs-on: ubuntu-latest + name: Build on OpenBSD ${{ inputs.openbsd_version }} with ${{ inputs.lua_version }} + + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Build on OpenBSD + uses: vmactions/openbsd-vm@v1 + with: + release: ${{ inputs.openbsd_version }} + usesh: true + prepare: | + # Install base build dependencies + pkg_add cmake ninja pkgconf \ + pcre2 sqlite3 openssl ragel icu4c \ + libsodium glib2 libunwind \ + perl-5 libarchive zstd xxhash \ + hyperscan file gettext-tools + + # Install Lua version based on user selection + case "${{ inputs.lua_version }}" in + luajit) + pkg_add luajit + ;; + lua51) + pkg_add lua%5.1 + ;; + lua53) + pkg_add lua%5.3 + ;; + esac + + run: | + set -e + + echo "==> Building Rspamd on OpenBSD $(uname -r) with ${{ inputs.lua_version }}" + + # Determine Lua CMake flags + case "${{ inputs.lua_version }}" in + luajit) + LUA_FLAGS="-DENABLE_LUAJIT=ON" + ;; + *) + LUA_FLAGS="-DENABLE_LUAJIT=OFF" + ;; + esac + + # Create build directory + mkdir -p build + cd build + + # Run CMake + echo "==> Running CMake configuration" + cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DENABLE_HYPERSCAN=ON \ + $LUA_FLAGS \ + -DSYSTEM_ZSTD=ON \ + -DSYSTEM_XXHASH=ON \ + -DENABLE_JEMALLOC=OFF \ + .. + + # Build + echo "==> Building Rspamd" + ninja -j$(sysctl -n hw.ncpu) + + # Run tests + echo "==> Running C++ unit tests" + ./test/rspamd-test-cxx || echo "C++ tests failed" + + echo "==> Running Lua unit tests" + ./test/rspamd-test -p /rspamd/lua || echo "Lua tests failed" + + echo "==> Build completed successfully!"