DocDoeAI / tests /test_deployment_migrations.py
asnannp's picture
deploy: sync backend to Space root (learn-lesson HF cache fix)
3bcdb36
Raw
History Blame Contribute Delete
917 Bytes
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
WORKFLOW = ROOT / ".github" / "workflows" / "deploy-backend-hf.yml"
def test_backend_deploy_applies_migrations_before_releasing_code() -> None:
workflow = WORKFLOW.read_text(encoding="utf-8")
assert '"supabase/migrations/**"' in workflow
assert "uses: supabase/setup-cli@v2" in workflow
assert "version: 2.110.0" in workflow
assert "supabase db push" in workflow
assert "--dry-run" in workflow
assert "SUPABASE_DB_URL: ${{ secrets.SUPABASE_DB_URL }}" in workflow
# Missing secret skips migrations with a warning; deploy still proceeds.
assert 'echo "applied=false"' in workflow or "applied=false" in workflow
assert "deploy:\n needs: migrate" in workflow
assert workflow.index(" migrate:") < workflow.index(" deploy:")
assert "HF_WRITE_TOKEN" in workflow