Spaces:
Running
Running
upload slice
Browse files- .github/workflows/ci.yml +16 -0
- py_backend/requirements.txt +2 -1
- py_backend/test_basic.py +14 -0
.github/workflows/ci.yml
CHANGED
|
@@ -49,6 +49,7 @@ jobs:
|
|
| 49 |
run: |
|
| 50 |
cd frontend
|
| 51 |
npm ci
|
|
|
|
| 52 |
npm run build
|
| 53 |
env:
|
| 54 |
CI: true
|
|
@@ -79,6 +80,15 @@ jobs:
|
|
| 79 |
sleep 1
|
| 80 |
done
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
- name: Run database migrations
|
| 83 |
env:
|
| 84 |
DATABASE_URL: postgresql://promptaid:promptaid@localhost:5433/promptaid
|
|
@@ -92,6 +102,12 @@ jobs:
|
|
| 92 |
alembic upgrade head
|
| 93 |
|
| 94 |
- name: Run back-end tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
run: |
|
| 96 |
cd py_backend
|
| 97 |
source .venv/bin/activate
|
|
|
|
| 49 |
run: |
|
| 50 |
cd frontend
|
| 51 |
npm ci
|
| 52 |
+
npm run lint
|
| 53 |
npm run build
|
| 54 |
env:
|
| 55 |
CI: true
|
|
|
|
| 80 |
sleep 1
|
| 81 |
done
|
| 82 |
|
| 83 |
+
- name: Setup MinIO bucket
|
| 84 |
+
env:
|
| 85 |
+
S3_ENDPOINT: http://localhost:9000
|
| 86 |
+
S3_ACCESS_KEY: promptaid
|
| 87 |
+
S3_SECRET_KEY: promptaid
|
| 88 |
+
run: |
|
| 89 |
+
pip install boto3
|
| 90 |
+
python -c "import boto3; s3 = boto3.client('s3', endpoint_url='http://localhost:9000', aws_access_key_id='promptaid', aws_secret_access_key='promptaid'); s3.create_bucket(Bucket='promptaid'); print('Bucket created')"
|
| 91 |
+
|
| 92 |
- name: Run database migrations
|
| 93 |
env:
|
| 94 |
DATABASE_URL: postgresql://promptaid:promptaid@localhost:5433/promptaid
|
|
|
|
| 102 |
alembic upgrade head
|
| 103 |
|
| 104 |
- name: Run back-end tests
|
| 105 |
+
env:
|
| 106 |
+
DATABASE_URL: postgresql://promptaid:promptaid@localhost:5433/promptaid
|
| 107 |
+
S3_ENDPOINT: http://localhost:9000
|
| 108 |
+
S3_ACCESS_KEY: promptaid
|
| 109 |
+
S3_SECRET_KEY: promptaid
|
| 110 |
+
S3_BUCKET: promptaid
|
| 111 |
run: |
|
| 112 |
cd py_backend
|
| 113 |
source .venv/bin/activate
|
py_backend/requirements.txt
CHANGED
|
@@ -7,4 +7,5 @@ boto3
|
|
| 7 |
python-dotenv
|
| 8 |
pydantic<2.0.0
|
| 9 |
openai # or other VLM client
|
| 10 |
-
pytest
|
|
|
|
|
|
| 7 |
python-dotenv
|
| 8 |
pydantic<2.0.0
|
| 9 |
openai # or other VLM client
|
| 10 |
+
pytest
|
| 11 |
+
httpx
|
py_backend/test_basic.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
from app.main import app
|
| 3 |
+
from fastapi.testclient import TestClient
|
| 4 |
+
|
| 5 |
+
client = TestClient(app)
|
| 6 |
+
|
| 7 |
+
def test_app_health():
|
| 8 |
+
"""Basic health check test"""
|
| 9 |
+
response = client.get("/docs")
|
| 10 |
+
assert response.status_code == 200
|
| 11 |
+
|
| 12 |
+
def test_app_exists():
|
| 13 |
+
"""Test that the app exists"""
|
| 14 |
+
assert app is not None
|