Add Docker integration tests to CI

Match test_docker.sh workflow:
- Build Docker image
- Verify backend imports
- Verify static files exist
- Test health endpoint
- Test API endpoint
- Test static files served

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
maziggy
2026-01-11 07:47:21 +01:00
co-authored by Claude Opus 4.5
parent 11482dd4d3
commit c665c3e6a3
+39 -13
View File
@@ -162,24 +162,50 @@ jobs:
run: npm run build
# ============================================================================
# Docker Build (optional, for release confidence)
# Docker Build & Test
# ============================================================================
docker-build:
name: Docker Build
docker-test:
name: Docker Test
runs-on: ubuntu-latest
needs: [backend-tests, frontend-build]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: bambuddy:test
cache-from: type=gha
cache-to: type=gha,mode=max
run: docker build -t bambuddy:test .
- name: Verify backend imports
run: docker run --rm bambuddy:test python -c "import backend.app.main; print('Backend imports OK')"
- name: Verify static files exist
run: docker run --rm bambuddy:test test -d /app/static
- name: Start container
run: |
docker run -d --name bambuddy-test -p 8000:8000 bambuddy:test
sleep 10
- name: Test health endpoint
run: |
HEALTH=$(curl -s http://localhost:8000/health)
echo "$HEALTH"
echo "$HEALTH" | grep -q "healthy"
- name: Test API endpoint
run: |
curl -s http://localhost:8000/api/v1/printers | head -c 200
- name: Test static files served
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/)
echo "Static files HTTP status: $STATUS"
[ "$STATUS" = "200" ]
- name: Show container logs on failure
if: failure()
run: docker logs bambuddy-test
- name: Cleanup
if: always()
run: docker rm -f bambuddy-test || true