File size: 917 Bytes
6ca3b92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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