Skip to content

chore: fetch enough commits for git describe to discover tags #123

chore: fetch enough commits for git describe to discover tags

chore: fetch enough commits for git describe to discover tags #123

Workflow file for this run

name: Regression Tests
on:
push:
paths:
- 'rules/**'
- 'tests/**'
- '.github/**'
pull_request:
paths:
- 'rules/**'
- 'tests/**'
- 'util/**'
- '.github/**'
merge_group:
# Pin tool versions to prevent problems
env:
GO_FTW_VERSION: '1.0.3'
jobs:
regression:
runs-on: ubuntu-latest
strategy:
matrix:
modsec_version: [modsec2-apache]
steps:
- name: "Checkout repo"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
- name: "Install dependencies"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download -R coreruleset/go-ftw "v${{ env.GO_FTW_VERSION }}" \
-p "ftw_${{ env.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
if ! [ "$(docker inspect ${{ matrix.modsec_version }} --format='{{.State.Running}}')" = "true" ]; then
echo "Web server failed to start. Aborting."
exit 1
fi
./ftw check -d tests/regression/tests
./ftw run \
-d tests/regression/tests \
--log-file "tests/logs/${{ matrix.modsec_version }}/error.log" \
--overrides tests/regression/httpd-overrides.yaml \
--show-failures-only
- name: "Change permissions of artifacts for upload"
if: failure()
run: |
# Files created from the container will belong to root
sudo chmod -R a+r tests/logs
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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