diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index fc35e6f9a..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,164 +0,0 @@ -name: Quality Assurance - -on: - push: - pull_request: - -jobs: - build-linux: - name: Linux (${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04] - platform: - - {label: "x64", arch: "amd64", configure: ""} - - {label: "x32", arch: "i386", configure: "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32"} - compiler: - - {label: "gcc", cc: "gcc", cxx: "g++"} - - {label: "clang", cc: "clang", cxx: "clang++"} - configure: - - {label: "with parser generation", opt: "--enable-parser-generation" } - - {label: "wo curl", opt: "--without-curl" } - - {label: "wo lua", opt: "--without-lua" } - - {label: "wo maxmind", opt: "--without-maxmind" } - - {label: "wo libxml", opt: "--without-libxml" } - - {label: "wo geoip", opt: "--without-geoip" } - - {label: "wo ssdeep", opt: "--without-ssdeep" } - - {label: "with lmdb", opt: "--with-lmdb" } - - {label: "with pcre", opt: "--with-pcre" } - exclude: - - platform: {label: "x32"} - configure: {label: "wo geoip"} - - platform: {label: "x32"} - configure: {label: "wo ssdeep"} - steps: - - name: Detect latest Lua dev package - id: detect_lua - shell: bash - run: | - set -euo pipefail - - sudo apt-get update -y -qq - - CANDIDATES="$(apt-cache pkgnames | grep -E '^liblua[0-9]+\.[0-9]+-dev$' || true)" - - if [ -z "$CANDIDATES" ]; then - echo "No libluaX.Y-dev package found" - exit 1 - fi - - BEST_PKG="$( - printf '%s\n' "$CANDIDATES" \ - | sed -E 's/^liblua([0-9]+\.[0-9]+)-dev$/\1 &/' \ - | sort -V \ - | tail -n1 \ - | awk '{print $2}' - )" - - if [ -z "$BEST_PKG" ]; then - echo "Failed to determine Lua package" - exit 1 - fi - - echo "lua_pkg=$BEST_PKG" >> "$GITHUB_OUTPUT" - echo "Using $BEST_PKG" - - - name: Setup Dependencies (common) - run: | - sudo dpkg --add-architecture ${{ matrix.platform.arch }} - sudo apt-get update -y -qq - sudo apt-get install -y libyajl-dev:${{ matrix.platform.arch }} \ - libcurl4-openssl-dev:${{ matrix.platform.arch }} \ - liblmdb-dev:${{ matrix.platform.arch }} \ - ${{ steps.detect_lua.outputs.lua_pkg }}:${{ matrix.platform.arch }} \ - libmaxminddb-dev:${{ matrix.platform.arch }} \ - libpcre2-dev:${{ matrix.platform.arch }} \ - pcre2-utils:${{ matrix.platform.arch }} \ - bison flex python3 python3-venv - - name: Setup Dependencies (x32) - if: ${{ matrix.platform.label == 'x32' }} - run: | - sudo apt-get install g++-multilib - sudo apt-get install -y libxml2-dev:${{ matrix.platform.arch }} \ - libpcre3-dev:${{ matrix.platform.arch }} - - name: Setup Dependencies (x64) - if: ${{ matrix.platform.label == 'x64' }} - run: | - sudo apt-get install -y libfuzzy-dev:${{ matrix.platform.arch }} - - - uses: actions/checkout@v6 - with: - submodules: recursive - fetch-depth: 0 - - name: build.sh - run: ./build.sh - - name: configure - env: - CC: ${{ matrix.compiler.cc }} - CXX: ${{ matrix.compiler.cxx }} - run: ./configure ${{ matrix.platform.configure }} ${{ matrix.configure.opt }} --enable-assertions=yes - - uses: ammaraskar/gcc-problem-matcher@cb2e3f949c41b7818628f35f8484a9b0acf90cf9 # master (2026-03-12) - - name: make - run: make -j "$(nproc)" - - name: check - run: make check - - build-windows: - name: Windows (${{ matrix.platform.label }}, ${{ matrix.configure.label }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-2022] - platform: - - {label: "x64", arch: "x86_64"} - configuration: [Release] - configure: - - {label: "full", opt: "" } - - {label: "wo curl", opt: "-DWITH_CURL=OFF" } - - {label: "wo lua", opt: "-DWITH_LUA=OFF" } - - {label: "wo maxmind", opt: "-DWITH_MAXMIND=OFF" } - - {label: "wo libxml", opt: "-DWITH_LIBXML2=OFF" } - - {label: "with lmdb", opt: "-DWITH_LMDB=ON" } - steps: - - uses: actions/checkout@v6 - with: - submodules: recursive - fetch-depth: 0 - - name: Install Conan - run: | - pip3 install conan --upgrade - conan profile detect - - uses: ammaraskar/msvc-problem-matcher@47189a176388253d16c6f0b79eee6274512b761a # master (2026-09-05) - - name: Build ${{ matrix.configuration }} ${{ matrix.platform.arch }} ${{ matrix.configure.label }} - shell: cmd - run: vcbuild.bat ${{ matrix.configuration }} ${{ matrix.platform.arch }} NO_ASAN "${{ matrix.configure.opt }}" - - name: Set up test environment - working-directory: build\win32\build\${{ matrix.configuration }} - env: - BASE_DIR: ..\..\..\.. - shell: cmd - run: | - copy unit_tests.exe %BASE_DIR%\test - copy regression_tests.exe %BASE_DIR%\test - copy libModSecurity.dll %BASE_DIR%\test - copy %BASE_DIR%\unicode.mapping %BASE_DIR%\test - md \tmp - md \bin - copy "C:\Program Files\Git\usr\bin\echo.exe" \bin - copy "C:\Program Files\Git\usr\bin\echo.exe" \bin\echo - - name: Disable tests that don't work on Windows - working-directory: test\test-cases\regression - shell: cmd - run: | - jq "map(if .title == \"Test match variable (1/n)\" then .enabled = 0 else . end)" issue-2423-msg-in-chain.json > tmp.json && move /Y tmp.json issue-2423-msg-in-chain.json - jq "map(if .title == \"Test match variable (2/n)\" then .enabled = 0 else . end)" issue-2423-msg-in-chain.json > tmp.json && move /Y tmp.json issue-2423-msg-in-chain.json - jq "map(if .title == \"Test match variable (3/n)\" then .enabled = 0 else . end)" issue-2423-msg-in-chain.json > tmp.json && move /Y tmp.json issue-2423-msg-in-chain.json - jq "map(if .title == \"Variable offset - FILES_NAMES\" then .enabled = 0 else . end)" offset-variable.json > tmp.json && move /Y tmp.json offset-variable.json - - name: Run tests - working-directory: build\win32\build - run: | - ctest -C ${{ matrix.configuration }} --output-on-failure - diff --git a/.github/workflows/ci_new.yml b/.github/workflows/ci_new.yml index 40d40ad28..6821e4424 100644 --- a/.github/workflows/ci_new.yml +++ b/.github/workflows/ci_new.yml @@ -1,20 +1,125 @@ -name: Quality Assurance new +name: Quality Assurance on: push: pull_request: jobs: + # Keep legacy Ubuntu 22.04 coverage, including x32, in a self-contained job. + # Remove this job when the legacy matrix is no longer needed. + build-linux-old: + name: Linux (old, ${{ matrix.os }}, ${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04] + platform: + - {label: "x64", arch: "amd64", configure: ""} + - {label: "x32", arch: "i386", configure: "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32"} + compiler: + - {label: "gcc", cc: "gcc", cxx: "g++"} + - {label: "clang", cc: "clang", cxx: "clang++"} + configure: + - {label: "with parser generation", opt: "--enable-parser-generation" } + - {label: "wo curl", opt: "--without-curl" } + - {label: "wo lua", opt: "--without-lua" } + - {label: "wo maxmind", opt: "--without-maxmind" } + - {label: "wo libxml", opt: "--without-libxml" } + - {label: "wo geoip", opt: "--without-geoip" } + - {label: "wo ssdeep", opt: "--without-ssdeep" } + - {label: "with lmdb", opt: "--with-lmdb" } + - {label: "with pcre", opt: "--with-pcre" } + exclude: + - platform: {label: "x32"} + configure: {label: "wo geoip"} + - platform: {label: "x32"} + configure: {label: "wo ssdeep"} + steps: + - name: Detect latest Lua dev package + id: detect_lua + shell: bash + run: | + set -euo pipefail + + sudo apt-get update -y -qq + + CANDIDATES="$(apt-cache pkgnames | grep -E '^liblua[0-9]+\.[0-9]+-dev$' || true)" + + if [ -z "$CANDIDATES" ]; then + echo "No libluaX.Y-dev package found" + exit 1 + fi + + BEST_PKG="$( + printf '%s\n' "$CANDIDATES" \ + | sed -E 's/^liblua([0-9]+\.[0-9]+)-dev$/\1 &/' \ + | sort -V \ + | tail -n1 \ + | awk '{print $2}' + )" + + if [ -z "$BEST_PKG" ]; then + echo "Failed to determine Lua package" + exit 1 + fi + + echo "lua_pkg=$BEST_PKG" >> "$GITHUB_OUTPUT" + echo "Using $BEST_PKG" + + - name: Setup Dependencies (common) + run: | + sudo dpkg --add-architecture ${{ matrix.platform.arch }} + sudo apt-get update -y -qq + sudo apt-get install -y libyajl-dev:${{ matrix.platform.arch }} \ + libcurl4-openssl-dev:${{ matrix.platform.arch }} \ + liblmdb-dev:${{ matrix.platform.arch }} \ + ${{ steps.detect_lua.outputs.lua_pkg }}:${{ matrix.platform.arch }} \ + libmaxminddb-dev:${{ matrix.platform.arch }} \ + libpcre2-dev:${{ matrix.platform.arch }} \ + pcre2-utils:${{ matrix.platform.arch }} \ + bison flex python3 python3-venv + - name: Setup Dependencies (x32) + if: ${{ matrix.platform.label == 'x32' }} + run: | + sudo apt-get install -y g++-multilib + sudo apt-get install -y libxml2-dev:${{ matrix.platform.arch }} \ + libpcre3-dev:${{ matrix.platform.arch }} + - name: Setup Dependencies (x64) + if: ${{ matrix.platform.label == 'x64' }} + run: | + sudo apt-get install -y libfuzzy-dev:${{ matrix.platform.arch }} \ + libxml2-dev:${{ matrix.platform.arch }} \ + libpcre3-dev:${{ matrix.platform.arch }} + + - uses: actions/checkout@v7 + with: + submodules: recursive + fetch-depth: 0 + - name: build.sh + run: ./build.sh + - name: configure + env: + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} + run: ./configure ${{ matrix.platform.configure }} ${{ matrix.configure.opt }} --enable-assertions=yes + - uses: ammaraskar/gcc-problem-matcher@cb2e3f949c41b7818628f35f8484a9b0acf90cf9 # master (2026-03-12) + - name: make + run: make -j "$(nproc)" + - name: check + run: make check + build-linux: - name: Linux (${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }}) + name: Linux (${{ matrix.os }}, ${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }}) # Ubuntu 24.04 does not provide native 32-bit (i386) installation images. # Only amd64 (x86_64) is officially supported. 32-bit has been removed from this matrix. - runs-on: ubuntu-24.04 + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: [ubuntu-24.04,ubuntu-26.04] platform: - { label: "x64", arch: "amd64", configure: "" } @@ -33,9 +138,13 @@ jobs: - { label: "with lmdb", opt: "--with-lmdb" } - { label: "with pcre2 (default)", opt: "" } - { label: "with pcre", opt: "--with-pcre" } + exclude: + # Ubuntu 26.04 no longer provides the PCRE1 development package. + - os: ubuntu-26.04 + configure: { label: "with pcre", opt: "--with-pcre" } steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive @@ -84,13 +193,16 @@ jobs: libxml2-dev \ libfuzzy-dev \ pcre2-utils \ - libpcre3-dev \ bison \ flex \ pkg-config \ python3 \ python3-venv + - name: Install PCRE1 development package + if: matrix.os != 'ubuntu-26.04' + run: sudo apt-get install -y libpcre3-dev + - name: Show Lua installation run: | which lua || true @@ -115,13 +227,13 @@ jobs: run: make check build-macos: - name: macOS (${{ matrix.configure.label }}) + name: macOS (${{ matrix.os }}, ${{ matrix.configure.label }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [macos-15, macos-26] + os: [macos-15,macos-26] configure: - { label: "with parser generation", opt: "--enable-parser-generation" } - { label: "without curl", opt: "--without-curl" } @@ -134,8 +246,14 @@ jobs: - { label: "with pcre2 (default)", opt: "" } - { label: "with pcre", opt: "--with-pcre" } + include: + - os: xcode-27 + configure: { label: "with pcre2 (default)", opt: "" } + - os: xcode-27 + configure: { label: "with parser generation", opt: "--enable-parser-generation" } + steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive @@ -189,7 +307,7 @@ jobs: - { label: "with lmdb", opt: "-DWITH_LMDB=ON" } steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive @@ -238,7 +356,7 @@ jobs: runs-on: macos-26 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive @@ -269,7 +387,7 @@ jobs: - name: Mark repo as safe for git run: git config --global --add safe.directory $GITHUB_WORKSPACE - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive