diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 12f9ac3..88a2ea3 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,7 +1,7 @@ # This workflow will build a golang project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go -name: Go +name: Build & Test on: push: @@ -11,7 +11,7 @@ on: jobs: - build: + unit_test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -26,3 +26,19 @@ jobs: - name: Test run: go test -v ./... + + integration_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Integration Test + run: | + docker build -f test/Dockerfile . -t caddy-fail2ban + docker run --rm --name caddy-fail2ban --detach -v $PWD/test/Caddyfile:/etc/caddy/Caddyfile caddy-fail2ban + docker exec caddy-fail2ban /usr/local/bin/caddy-fail2ban-test.sh + docker logs caddy-fail2ban + docker stop caddy-fail2ban diff --git a/Dockerfile b/test/Dockerfile similarity index 100% rename from Dockerfile rename to test/Dockerfile