Update README.md #356
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
| name: FastAPI Start Check | |
| on: [push] | |
| jobs: | |
| fastapi-start: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Start database using docker-compose | |
| run: | | |
| docker compose up -d db | |
| - name: Wait for Postgres to become ready | |
| run: | | |
| for i in {1..20}; do | |
| if docker exec inquiro_db pg_isready -U inquiro; then | |
| echo "Postgres is ready!" | |
| break | |
| fi | |
| echo "Waiting for Postgres..." | |
| sleep 2 | |
| done | |
| - name: Install backend dependencies | |
| working-directory: backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Start FastAPI to verify it boots | |
| working-directory: backend | |
| env: | |
| POSTGRES_USER: inquiro | |
| POSTGRES_PASSWORD: inquiro | |
| POSTGRES_DB: inquiro_db | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: "5433" | |
| JWT_SECRET_KEY: "3e3cc0b2f8b54b3d6aa597faccb2f9c41b19b1c24befe29661bafbd42e3afe3e" | |
| DATABASE_URL: "postgresql+asyncpg://inquiro:inquiro@localhost:5433/inquiro_db" | |
| run: | | |
| uvicorn app.main:app --host 0.0.0.0 --port 8000 & | |
| PID=$! | |
| sleep 5 | |
| if ! ps -p $PID > /dev/null; then | |
| echo "❌ FastAPI failed to start." | |
| exit 1 | |
| fi | |
| echo "✅ FastAPI started successfully" | |
| kill $PID |