add CRS regression tests with ftwrunner in CI #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test make and install | |
| on: | |
| push: | |
| pull_request: | |
| branches: [main] | |
| permissions: {} | |
| jobs: | |
| make-targets: | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| go-version: [1.25.x, 1.26.x] | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 #for better blame info | |
| - name: Install macOS dependencies | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install autoconf automake libtool | |
| - name: Setup | |
| run: | | |
| ./build.sh | |
| ./configure | |
| - name: Compile | |
| run: | | |
| make V=1 | |
| - name: Test | |
| run: | | |
| make check | |
| - name: Install | |
| run: | | |
| sudo make V=1 install | |
| - name: Run CRS tests with ftwrunner | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get install -y libpcre2-dev libyaml-dev | |
| sudo ldconfig | |
| git clone --depth 1 -b feat/update-libcoraza-api https://github.com/ppomes/ftwrunner.git /tmp/ftwrunner | |
| cd /tmp/ftwrunner | |
| autoreconf --install | |
| ./configure | |
| make | |
| git clone --depth 1 https://github.com/coreruleset/coreruleset.git /tmp/coreruleset | |
| printf 'SecRuleEngine On\nSecRequestBodyAccess On\nSecResponseBodyAccess On\nSecResponseBodyMimeType text/plain text/html text/xml application/json\nSecAction "id:900000,phase:1,nolog,pass,t:none,setvar:tx.blocking_paranoia_level=4,setvar:tx.detection_paranoia_level=4"\n' > coraza.conf | |
| printf 'include coraza.conf\ninclude /tmp/coreruleset/crs-setup.conf.example\ninclude /tmp/coreruleset/plugins/empty-before.conf\ninclude /tmp/coreruleset/rules/*.conf\ninclude /tmp/coreruleset/plugins/empty-after.conf\n' > coraza_includes.conf | |
| printf 'modsecurity_config: coraza_includes.conf\nftwtest_root: /tmp/coreruleset/tests/regression/tests\n' > ftwrunner.yaml | |
| ./src/ftwrunner -e coraza || true |