|
| 1 | +name: Quality Assurance new |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-linux: |
| 9 | + name: Linux (${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }}) |
| 10 | + |
| 11 | + # Ubuntu 24.04 does not provide native 32-bit (i386) installation images. |
| 12 | + # Only amd64 (x86_64) is officially supported. 32-bit has been removed from this matrix. |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + platform: |
| 19 | + - { label: "x64", arch: "amd64", configure: "" } |
| 20 | + |
| 21 | + compiler: |
| 22 | + - { label: "gcc", cc: "gcc", cxx: "g++" } |
| 23 | + - { label: "clang", cc: "clang", cxx: "clang++" } |
| 24 | + |
| 25 | + configure: |
| 26 | + - { label: "with parser generation", opt: "--enable-parser-generation" } |
| 27 | + - { label: "without curl", opt: "--without-curl" } |
| 28 | + - { label: "without lua", opt: "--without-lua" } |
| 29 | + - { label: "without maxmind", opt: "--without-maxmind" } |
| 30 | + - { label: "without libxml", opt: "--without-libxml" } |
| 31 | + - { label: "without geoip", opt: "--without-geoip" } |
| 32 | + - { label: "without ssdeep", opt: "--without-ssdeep" } |
| 33 | + - { label: "with lmdb", opt: "--with-lmdb" } |
| 34 | + - { label: "with pcre2 (default)", opt: "" } |
| 35 | + - { label: "with pcre", opt: "--with-pcre" } |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v6 |
| 39 | + with: |
| 40 | + fetch-depth: 0 |
| 41 | + submodules: recursive |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + run: | |
| 45 | + sudo apt-get update -y -qq |
| 46 | + sudo apt-get install -y \ |
| 47 | + libyajl-dev \ |
| 48 | + libcurl4-openssl-dev \ |
| 49 | + liblmdb-dev \ |
| 50 | + liblua5.2-dev \ |
| 51 | + libmaxminddb-dev \ |
| 52 | + libpcre2-dev \ |
| 53 | + libxml2-dev \ |
| 54 | + libfuzzy-dev \ |
| 55 | + pcre2-utils \ |
| 56 | + libpcre3-dev \ |
| 57 | + bison \ |
| 58 | + flex \ |
| 59 | + pkg-config |
| 60 | +
|
| 61 | +
|
| 62 | + - name: Run build preparation script |
| 63 | + run: ./build.sh |
| 64 | + |
| 65 | + - name: Configure |
| 66 | + env: |
| 67 | + CC: ${{ matrix.compiler.cc }} |
| 68 | + CXX: ${{ matrix.compiler.cxx }} |
| 69 | + run: ./configure ${{ matrix.platform.configure }} ${{ matrix.configure.opt }} --enable-assertions=yes |
| 70 | + |
| 71 | + - uses: ammaraskar/gcc-problem-matcher@master |
| 72 | + |
| 73 | + - name: Compile |
| 74 | + run: make -j "$(nproc)" |
| 75 | + |
| 76 | + - name: Run tests |
| 77 | + run: make check |
| 78 | + |
| 79 | + build-macos: |
| 80 | + name: macOS (${{ matrix.configure.label }}) |
| 81 | + runs-on: macos-15 |
| 82 | + |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + matrix: |
| 86 | + configure: |
| 87 | + - { label: "with parser generation", opt: "--enable-parser-generation" } |
| 88 | + - { label: "without curl", opt: "--without-curl" } |
| 89 | + - { label: "without lua", opt: "--without-lua" } |
| 90 | + - { label: "without maxmind", opt: "--without-maxmind" } |
| 91 | + - { label: "without libxml", opt: "--without-libxml" } |
| 92 | + - { label: "without geoip", opt: "--without-geoip" } |
| 93 | + - { label: "without ssdeep", opt: "--without-ssdeep" } |
| 94 | + - { label: "with lmdb", opt: "--with-lmdb" } |
| 95 | + - { label: "with pcre2 (default)", opt: "" } |
| 96 | + - { label: "with pcre", opt: "--with-pcre" } |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v6 |
| 100 | + with: |
| 101 | + fetch-depth: 0 |
| 102 | + submodules: recursive |
| 103 | + |
| 104 | + - name: Install dependencies |
| 105 | + # curl and pcre2 are typically already available in the macOS runner image |
| 106 | + run: | |
| 107 | + brew install autoconf \ |
| 108 | + automake \ |
| 109 | + libtool \ |
| 110 | + yajl \ |
| 111 | + lmdb \ |
| 112 | + lua \ |
| 113 | + libmaxminddb \ |
| 114 | + libxml2 \ |
| 115 | + ssdeep \ |
| 116 | + pcre \ |
| 117 | + bison \ |
| 118 | + flex |
| 119 | +
|
| 120 | + - name: Run build preparation script |
| 121 | + run: ./build.sh |
| 122 | + |
| 123 | + - name: Configure |
| 124 | + run: ./configure ${{ matrix.configure.opt }} --enable-assertions=yes |
| 125 | + |
| 126 | + - uses: ammaraskar/gcc-problem-matcher@master |
| 127 | + |
| 128 | + - name: Compile |
| 129 | + run: make -j "$(sysctl -n hw.logicalcpu)" |
| 130 | + |
| 131 | + - name: Run tests |
| 132 | + run: make check |
| 133 | + |
| 134 | + build-windows: |
| 135 | + name: Windows (${{ matrix.platform.label }}, ${{ matrix.configure.label }}) |
| 136 | + runs-on: windows-2025 |
| 137 | + |
| 138 | + strategy: |
| 139 | + fail-fast: false |
| 140 | + matrix: |
| 141 | + platform: |
| 142 | + - { label: "x64", arch: "x86_64" } |
| 143 | + configuration: [Release] |
| 144 | + configure: |
| 145 | + - { label: "full", opt: "" } |
| 146 | + - { label: "without curl", opt: "-DWITH_CURL=OFF" } |
| 147 | + - { label: "without lua", opt: "-DWITH_LUA=OFF" } |
| 148 | + - { label: "without maxmind", opt: "-DWITH_MAXMIND=OFF" } |
| 149 | + - { label: "without libxml", opt: "-DWITH_LIBXML2=OFF" } |
| 150 | + - { label: "with lmdb", opt: "-DWITH_LMDB=ON" } |
| 151 | + |
| 152 | + steps: |
| 153 | + - uses: actions/checkout@v6 |
| 154 | + with: |
| 155 | + fetch-depth: 0 |
| 156 | + submodules: recursive |
| 157 | + |
| 158 | + - name: Install Conan package manager |
| 159 | + run: | |
| 160 | + pip3 install conan --upgrade |
| 161 | + conan profile detect |
| 162 | +
|
| 163 | + - uses: ammaraskar/msvc-problem-matcher@master |
| 164 | + |
| 165 | + - name: Build project |
| 166 | + shell: cmd |
| 167 | + run: vcbuild.bat ${{ matrix.configuration }} ${{ matrix.platform.arch }} NO_ASAN "${{ matrix.configure.opt }}" |
| 168 | + |
| 169 | + - name: Prepare test environment |
| 170 | + working-directory: build\win32\build\${{ matrix.configuration }} |
| 171 | + env: |
| 172 | + BASE_DIR: ..\..\..\.. |
| 173 | + shell: cmd |
| 174 | + run: | |
| 175 | + copy unit_tests.exe %BASE_DIR%\test |
| 176 | + copy regression_tests.exe %BASE_DIR%\test |
| 177 | + copy libModSecurity.dll %BASE_DIR%\test |
| 178 | + copy %BASE_DIR%\unicode.mapping %BASE_DIR%\test |
| 179 | + md \tmp |
| 180 | + md \bin |
| 181 | + copy "C:\Program Files\Git\usr\bin\echo.exe" \bin |
| 182 | + copy "C:\Program Files\Git\usr\bin\echo.exe" \bin\echo |
| 183 | +
|
| 184 | + - name: Disable unsupported tests on Windows |
| 185 | + working-directory: test\test-cases\regression |
| 186 | + shell: cmd |
| 187 | + run: | |
| 188 | + 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 |
| 189 | + 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 |
| 190 | + 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 |
| 191 | + 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 |
| 192 | +
|
| 193 | + - name: Run tests |
| 194 | + working-directory: build\win32\build |
| 195 | + run: ctest -C ${{ matrix.configuration }} --output-on-failure |
| 196 | + |
| 197 | + cppcheck: |
| 198 | + name: Static analysis (cppcheck) |
| 199 | + runs-on: macos-15 |
| 200 | + |
| 201 | + steps: |
| 202 | + - uses: actions/checkout@v6 |
| 203 | + with: |
| 204 | + fetch-depth: 0 |
| 205 | + submodules: recursive |
| 206 | + |
| 207 | + - name: Install cppcheck |
| 208 | + run: | |
| 209 | + brew install autoconf automake libtool cppcheck libmaxminddb yajl lua lmdb ssdeep |
| 210 | +
|
| 211 | + - name: Configure project |
| 212 | + run: | |
| 213 | + ./build.sh |
| 214 | + ./configure |
| 215 | +
|
| 216 | + - name: Run cppcheck |
| 217 | + run: make check-static |
| 218 | + |
| 219 | + cppcheck-linux: |
| 220 | + name: Static analysis (cppcheck, Linux, debian:sid) |
| 221 | + runs-on: ubuntu-latest |
| 222 | + container: debian:sid |
| 223 | + |
| 224 | + steps: |
| 225 | + - name: Install basic tools |
| 226 | + run: | |
| 227 | + apt-get update |
| 228 | + apt-get install -y git |
| 229 | +
|
| 230 | + - name: Mark repo as safe for git |
| 231 | + run: git config --global --add safe.directory $GITHUB_WORKSPACE |
| 232 | + |
| 233 | + - uses: actions/checkout@v6 |
| 234 | + with: |
| 235 | + fetch-depth: 0 |
| 236 | + submodules: recursive |
| 237 | + |
| 238 | + |
| 239 | + - name: Install dependencies (v2 style) |
| 240 | + run: | |
| 241 | + apt-get update |
| 242 | + apt-get install -y \ |
| 243 | + autoconf \ |
| 244 | + automake \ |
| 245 | + build-essential \ |
| 246 | + libtool \ |
| 247 | + pkg-config \ |
| 248 | + cppcheck \ |
| 249 | + libyajl-dev \ |
| 250 | + libcurl4-openssl-dev \ |
| 251 | + liblmdb-dev \ |
| 252 | + liblua5.2-dev \ |
| 253 | + libmaxminddb-dev \ |
| 254 | + libpcre2-dev \ |
| 255 | + libxml2-dev \ |
| 256 | + libfuzzy-dev \ |
| 257 | + pcre2-utils \ |
| 258 | + bison \ |
| 259 | + flex |
| 260 | +
|
| 261 | + - name: Run build preparation script |
| 262 | + run: ./build.sh |
| 263 | + |
| 264 | + - name: Configure project |
| 265 | + run: ./configure |
| 266 | + |
| 267 | + - name: Run cppcheck |
| 268 | + run: make check-static |
0 commit comments