This commit is contained in:
@@ -107,6 +107,57 @@ jobs:
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# LOGGING: Smoke Test Phase
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
- name: 🧪 Run Smoke Test
|
||||
run: |
|
||||
echo "╔══════════════════════════════════════════════════════════════════════════════╗"
|
||||
echo "║ Step: Smoke Test ║"
|
||||
echo "╚══════════════════════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "🧪 Starting local smoke test to verify build integrity..."
|
||||
|
||||
# Start the application in the background
|
||||
# We use the standalone output which is what runs in production
|
||||
# We need to provide minimal env vars for it to start
|
||||
export PORT=3001
|
||||
export NODE_ENV=production
|
||||
export NEXT_PUBLIC_BASE_URL="http://localhost:3001"
|
||||
|
||||
node .next/standalone/server.js &
|
||||
APP_PID=$!
|
||||
|
||||
echo "⏳ Waiting for application to start on port 3001 (PID: $APP_PID)..."
|
||||
|
||||
# Wait for health check to pass
|
||||
MAX_RETRIES=10
|
||||
RETRY_COUNT=0
|
||||
SUCCESS=false
|
||||
|
||||
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
|
||||
if curl -s http://localhost:3001/health > /dev/null; then
|
||||
SUCCESS=true
|
||||
break
|
||||
fi
|
||||
echo " • Waiting... ($((RETRY_COUNT + 1))/$MAX_RETRIES)"
|
||||
sleep 3
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
done
|
||||
|
||||
if [ "$SUCCESS" = true ]; then
|
||||
echo "✅ Smoke test passed: Application started successfully"
|
||||
kill $APP_PID
|
||||
else
|
||||
echo "❌ Smoke test failed: Application failed to start or health check timed out"
|
||||
echo "🔍 Application Logs:"
|
||||
# Try to get some logs before killing
|
||||
kill -0 $APP_PID 2>/dev/null && sleep 2
|
||||
kill $APP_PID
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# LOGGING: Deployment Phase
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user