From f4b2f4ddb67b3d3d0dcf845a442b7f34e31d4957 Mon Sep 17 00:00:00 2001 From: XiaoXia Bot Date: Thu, 16 Jul 2026 11:04:45 +0800 Subject: [PATCH] =?UTF-8?q?chore(ci):=20Alembic=E6=AD=A5=E9=AA=A4=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AF=A6=E7=BB=86=E9=94=99=E8=AF=AF=E8=BE=93=E5=87=BA?= =?UTF-8?q?=20-=20=E6=8E=92=E6=9F=A5=E5=A4=B1=E8=B4=A5=E6=A0=B9=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-cd.yml | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 4d12e6b3f..7c4fc61d6 100755 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -245,17 +245,33 @@ jobs: - name: Validate Alembic migrations if: env.IS_FRONTEND_ONLY != 'true' shell: bash - run: 'set -eu - - python3 -m alembic upgrade head --sql > /tmp/alembic-upgrade.sql - - test -s /tmp/alembic-upgrade.sql - - grep -q "Running upgrade" /tmp/alembic-upgrade.sql - + shell: bash + run: | + set +e + echo "=== Validating Alembic migrations ===" + python3 -m alembic upgrade head --sql > /tmp/alembic-upgrade.sql 2> /tmp/alembic-err.log + RC=0 + echo "Exit code: " + if [ -ne 0 ]; then + echo "=== STDERR ===" + cat /tmp/alembic-err.log + echo "=== STDOUT (last 30 lines) ===" + tail -30 /tmp/alembic-upgrade.sql + exit 1 + fi + if ! test -s /tmp/alembic-upgrade.sql; then + echo "ERROR: empty output" + cat /tmp/alembic-err.log + exit 1 + fi + if ! grep -q "Running upgrade" /tmp/alembic-upgrade.sql; then + echo "ERROR: no Running upgrade" + head -30 /tmp/alembic-upgrade.sql + exit 1 + fi python3 scripts/check_schema_metadata.py - - ' + echo "Alembic validation PASSED" + set -e - name: Check migration safety if: env.IS_FRONTEND_ONLY != 'true' shell: bash