Merge pull request #3407 from EsadCetiner/v4.0-953100/dev #105
This file contains 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: Regression Tests | |
on: | |
push: | |
paths: | |
- 'rules/**' | |
- 'tests/**' | |
- '.github/**' | |
pull_request: | |
paths: | |
- 'rules/**' | |
- 'tests/**' | |
- 'util/**' | |
- '.github/**' | |
jobs: | |
regression: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
modsec_version: [modsec2-apache] | |
steps: | |
- name: "Checkout repo" | |
uses: actions/checkout@v4 | |
- name: "Install dependencies" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GO_FTW_VERSION: '0.6.3' | |
run: | | |
gh release download -R coreruleset/go-ftw v${GO_FTW_VERSION} -p "ftw_${GO_FTW_VERSION}_linux_amd64.tar.gz" -O - | tar -xzvf - ftw | |
- name: "Run tests for ${{ matrix.modsec_version }}" | |
run: | | |
mkdir -p tests/logs/${{ matrix.modsec_version }}/{nginx,apache2} | |
docker-compose -f ./tests/docker-compose.yml up -d "${{ matrix.modsec_version }}" | |
docker-compose -f ./tests/docker-compose.yml logs | |
[ $(docker inspect ${{ matrix.modsec_version }} --format='{{.State.Running}}') = 'true' ] | |
./ftw check -d tests/regression/tests | |
./ftw run -d tests/regression/tests --show-failures-only | |
env: | |
FTW_LOGFILE: './tests/logs/${{ matrix.modsec_version }}/error.log' | |
- name: "Change permissions if failed" | |
if: failure() | |
run: | | |
# we want to get the audit log, so change permissions (file is only for root on docker) | |
sudo chmod 644 tests/logs/${{ matrix.modsec_version }}/modsec_audit.log | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: waf-logs | |
path: tests/logs/${{ matrix.modsec_version }} | |
- name: Clean docker-compose | |
run: | | |
docker-compose -f ./tests/docker-compose.yml stop "${{ matrix.modsec_version }}" | |
docker-compose -f ./tests/docker-compose.yml down |