Procházet zdrojové kódy

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>
maziggy před 4 měsíci
rodič
revize
c665c3e6a3
1 změnil soubory, kde provedl 39 přidání a 13 odebrání
  1. 39 13
      .github/workflows/ci.yml

+ 39 - 13
.github/workflows/ci.yml

@@ -162,24 +162,50 @@ jobs:
         run: npm run build
         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
     runs-on: ubuntu-latest
     needs: [backend-tests, frontend-build]
     needs: [backend-tests, frontend-build]
     steps:
     steps:
       - uses: actions/checkout@v4
       - uses: actions/checkout@v4
 
 
-      - name: Set up Docker Buildx
-        uses: docker/setup-buildx-action@v3
-
       - name: Build Docker image
       - 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