v0.2.0 beta: pharmacy maps, patient UX, and reliability #552
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # File Name: backend-ci.yml | |
| # Role: Checks backend behavior and PostgreSQL migration compatibility on branch updates. | |
| name: FastAPI CI | |
| on: | |
| push: | |
| branches: [ "main", "beta/**" ] | |
| pull_request: | |
| branches: [ "main", "beta/**" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - name: Source Code Checkout | |
| uses: actions/checkout@v7 | |
| - name: Set up Python for FastAPI | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.11' # 추후 v3.12로 migrate할 가능성 있음 | |
| cache: 'pip' | |
| cache-dependency-path: backend/requirements*.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| - name: Run FastAPI sanity check | |
| env: # 환경 변수 추가/삭제 시 변경 요망 | |
| GEMINI_API_KEY: test-key-for-ci | |
| PUBLIC_DATA_API_KEY: test-key-for-ci | |
| run: | | |
| python -c "import main; print('main import succeeded')" | |
| - name: Run backend tests | |
| env: | |
| GEMINI_API_KEY: test-key-for-ci | |
| PUBLIC_DATA_API_KEY: test-key-for-ci | |
| run: python -m pytest -p no:cacheprovider tests | |
| postgres-migrations: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: medbuddy | |
| POSTGRES_PASSWORD: medbuddy-ci | |
| POSTGRES_DB: medbuddy | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U medbuddy -d medbuddy" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - name: Source Code Checkout | |
| uses: actions/checkout@v7 | |
| - name: Set up Python for migrations | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| cache-dependency-path: backend/requirements*.txt | |
| - name: Install backend dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| - name: Validate PostgreSQL migration round trip | |
| env: | |
| APP_ENV: test | |
| DATABASE_URL: postgresql+psycopg://medbuddy:medbuddy-ci@localhost:5432/medbuddy | |
| GEMINI_API_KEY: test-key-for-ci | |
| MEDBUDDY_RUN_POSTGRES_INTEGRATION: '1' | |
| PUBLIC_DATA_API_KEY: test-key-for-ci | |
| run: | | |
| python -m alembic -c alembic.ini upgrade head | |
| python -m alembic -c alembic.ini downgrade base | |
| python -m alembic -c alembic.ini upgrade head | |
| python -m alembic -c alembic.ini current | |
| python -m pytest -p no:cacheprovider tests/test_postgres_catalog_sync.py |