-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.59 KB
/
Copy pathfast-api.yml
File metadata and controls
58 lines (50 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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