fix(ci): Validate增加独立PG容器,修复alembic迁移检查全部失败 #405
Reference in New Issue
Block a user
Delete Branch "fix/ci-validate-pg-container"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
所有open PR的Validate Code Quality And Tests都失败,根因是 Validate Alembic migrations步骤无法连接数据库。
根因分析
alembic upgrade head --sql需要连接数据库读取alembic_version表确定起始版本DATABASE_URL指向127.0.0.1:5432(端口关闭)修复方案
在
Validate Alembic migrations步骤前增加一步:启动独立PG容器(随机端口映射),通过GITHUB_ENV更新DATABASE_URL。步骤结束后always()确保清理容器。参考PR #399的DB Migrations子job实现(已验证通过),此为最小改动版本,不拆分job。
验收标准