-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor and basic ci and pytests install
- Loading branch information
1 parent
efb5aac
commit b2f368e
Showing
19 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Python package | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:15 | ||
env: | ||
POSTGRES_USER: ai_plat | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: ai_plat | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd "pg_isready -U ai_plat" --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
redis-version: [6] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files | ||
|
||
- name: Start Redis | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-version: ${{ matrix.redis-version }} | ||
|
||
- name: Test with pytest | ||
run: | | ||
pytest tests |
This file contains 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 renamed without changes.
This file contains 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 renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import logging | ||
from fastapi import APIRouter | ||
|
||
router = APIRouter() | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@router.get("/") | ||
async def boilerplate(): | ||
""" | ||
Boilerplate | ||
""" | ||
return {"success": 1} |
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import logging | ||
from fastapi import APIRouter | ||
|
||
router = APIRouter() | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@router.get("/") | ||
async def boilerplate(): | ||
""" | ||
Boilerplate | ||
""" | ||
return {"success": 1} |
Empty file.
Empty file.
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
from fastapi import APIRouter | ||
from src.controllers.auth_controller import router as auth_router | ||
from src.auth.controller import router as auth_router | ||
from src.llm.controller import router as llm_router | ||
from src.document_manager.controller import router as document_manager_router | ||
|
||
internal_router = APIRouter() | ||
|
||
# mount all api endpoints here | ||
internal_router.include_router(auth_router, prefix="/auth", tags=["Authentication"]) | ||
internal_router.include_router(llm_router, prefix="/llm", tags=["LLM"]) | ||
internal_router.include_router( | ||
document_manager_router, prefix="/document", tags=["Document Manager"] | ||
) |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import pytest | ||
|
||
# from httpx import AsyncClient | ||
from main import app | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_read_root(): | ||
assert True |