diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index df8f9a753..20e687565 100755 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -83,6 +83,20 @@ jobs: fi echo "🔧 包含后端/公共变更,继续完整检查" + - name: Runner PG诊断 + shell: sh + run: | + set +e + echo "=== PG诊断 ===" + echo "DATABASE_URL=$DATABASE_URL" + echo "--- PG进程 ---" + ps aux | grep postgres | grep -v grep + echo "--- 5432端口 ---" + ss -tlnp 2>/dev/null | grep 5432 || netstat -tlnp 2>/dev/null | grep 5432 || echo "port 5432: no listen" + echo "--- 连接测试 ---" + python3 -c "import os,sys;from sqlalchemy import create_engine,text;e=create_engine(os.environ['DATABASE_URL'],connect_args={'connect_timeout':5});c=e.connect();r=c.execute(text('SELECT version()'));print('PG:',r.fetchone()[0][:60]);r=c.execute(text("SELECT count(*) FROM information_schema.tables WHERE table_schema='public'"));print('tables:',r.fetchone()[0]);c.close();print('OK')" 2>&1 + echo "=== 诊断结束 ===" + - name: Detect frontend-only change shell: bash env: