Bump github.com/caddyserver/caddy/v2 from 2.9.0 to 2.9.1 in the go_modules group across 1 directory #80
Workflow file for this run
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: Build and test Caddy with WAF | |
permissions: | |
contents: read | |
pull-requests: write | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
name: Build and Test Caddy WAF | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y wget git build-essential | |
- name: Install Go 1.23.4 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23.4' | |
- name: Validate Go Installation | |
run: | | |
go version | |
if ! go version | grep -q "go1.23.4"; then | |
echo "Go installation failed or incorrect version" | |
exit 1 | |
fi | |
- name: Clone caddy-waf Repository | |
run: | | |
git clone https://github.com/fabriziosalmi/caddy-waf.git | |
cd caddy-waf | |
- name: Validate Repository Cloning | |
run: | | |
if [ ! -d "caddy-waf" ]; then | |
echo "Repository cloning failed" | |
exit 1 | |
fi | |
- name: Install Go Dependencies | |
run: | | |
cd caddy-waf | |
go mod tidy | |
go get -v github.com/fabriziosalmi/caddy-waf github.com/caddyserver/caddy/v2 github.com/oschwald/maxminddb-golang | |
- name: Download GeoLite2 Country Database | |
run: | | |
cd caddy-waf | |
wget https://git.io/GeoLite2-Country.mmdb | |
- name: Validate GeoLite2 Download | |
run: | | |
cd caddy-waf | |
if [ ! -f "GeoLite2-Country.mmdb" ]; then | |
echo "GeoLite2 database download failed" | |
exit 1 | |
fi | |
- name: Build Caddy with caddy-waf | |
run: | | |
cd caddy-waf | |
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest | |
xcaddy build --with github.com/fabriziosalmi/caddy-waf=./ | |
- name: Validate Build | |
run: | | |
cd caddy-waf | |
if [ ! -f "caddy" ]; then | |
echo "Caddy build failed" | |
exit 1 | |
fi | |
- name: Test Caddy Run and Validate WAF Provisioning | |
run: | | |
cd caddy-waf | |
chmod +x caddy | |
./caddy run > caddy_output.log 2>&1 & | |
sleep 5 | |
if ! pgrep -f "caddy run"; then | |
echo "Caddy run failed" | |
cat caddy_output.log | |
exit 1 | |
fi | |
if ! grep -q "WAF middleware provisioned successfully" caddy_output.log; then | |
echo "WAF provisioning log not found" | |
cat caddy_output.log | |
exit 1 | |
fi | |
echo "Caddy WAF build and run successful with WAF middleware provisioned" | |
- name: Clean Up | |
if: always() | |
run: | | |
pkill -f "caddy run" || true | |
echo "Cleaned up running Caddy instances" |