Skip to content

Commit a2cbe77

Browse files
committed
api full working after .env with pytest ruff unit testing cicd and improvement update and manage project structure as modified: routers/auth.py renamed: auth.py -> services/auth.py
build failed during github action so update routers/patients.py add auto render deployment when build pass in github action modified: .github/workflows/ci.yml
1 parent 7ec4723 commit a2cbe77

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,29 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up Python
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: '3.11'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -r requirements.txt
25-
pip install ruff pytest
26-
- name: Run Ruff Linting
27-
run: ruff check .
28-
- name: Run Tests
29-
run: |
30-
export DATABASE_URL="mongodb://localhost:27017/testdb"
31-
export SECRET_KEY="secret-key"
32-
pytest
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
pip install ruff pytest
28+
29+
- name: Run Ruff Linting
30+
run: ruff check .
31+
32+
- name: Run Tests
33+
env:
34+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
35+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
36+
run: pytest
37+
38+
- name: Deploy to Render
39+
if: github.ref == 'refs/heads/main' && success()
40+
run: |
41+
curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK }}

routers/patients.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from fastapi.responses import JSONResponse
33
import pymongo
44

5-
from auth import get_current_doctor
5+
from services.auth import get_current_doctor
66
from models.patient import Patient, PatientUpdate, PatientCreate
77

88
router = APIRouter()

0 commit comments

Comments
 (0)