Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run linting
run: |
pip install ruff
ruff check .
continue-on-error: true

- name: Run unit tests
run: |
mkdir -p test-results
pytest tests/unit -v --junitxml=test-results/junit-unit.xml

- name: Run integration tests
run: |
pytest tests/integration -v --junitxml=test-results/junit-integration.xml

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-results/*.xml
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
ENV/
env/
.venv/

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/
junit.xml

# Generated files
generated_tests/
data/
test-results/
*.db

# Logs
*.log

# OS
.DS_Store
Thumbs.db

# Environment
.env
.env.local

# Ruff cache
.ruff_cache/

# Streamlit
.streamlit/
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Dockerfile for FastAPI backend
FROM python:3.11-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY app/ app/
COPY openapi_specs/ openapi_specs/

# Create data directories
RUN mkdir -p /app/data /app/generated_tests

# Environment variables
ENV DATABASE_PATH=/app/data/app.db
ENV GENERATED_TESTS_DIR=/app/generated_tests
ENV DEFAULT_TARGET_URL=http://example-api:8001

EXPOSE 8000

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
14 changes: 14 additions & 0 deletions Dockerfile.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dockerfile for example target API
FROM python:3.11-slim

WORKDIR /app

# Install dependencies
RUN pip install --no-cache-dir fastapi uvicorn pydantic

# Copy example API code
COPY example_api/ example_api/

EXPOSE 8001

CMD ["uvicorn", "example_api.main:app", "--host", "0.0.0.0", "--port", "8001"]
25 changes: 25 additions & 0 deletions Dockerfile.streamlit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dockerfile for Streamlit UI
FROM python:3.11-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY app/ app/
COPY streamlit_app/ streamlit_app/
COPY openapi_specs/ openapi_specs/

# Create data directories
RUN mkdir -p /app/data /app/generated_tests

# Environment variables
ENV DATABASE_PATH=/app/data/app.db
ENV GENERATED_TESTS_DIR=/app/generated_tests
ENV DEFAULT_TARGET_URL=http://example-api:8001

EXPOSE 8501

CMD ["streamlit", "run", "streamlit_app/app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
63 changes: 63 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.PHONY: dev ui example test e2e lint install clean

# Install dependencies
install:
pip install -r requirements.txt

# Run the FastAPI backend
dev:
uvicorn app.main:app --reload --port 8000

# Run the Streamlit UI
ui:
streamlit run streamlit_app/app.py --server.port 8501

# Run the example target API
example:
uvicorn example_api.main:app --reload --port 8001

# Run all tests
test:
pytest tests/ -v --junitxml=test-results/junit.xml

# Run only unit tests
test-unit:
pytest tests/unit/ -v

# Run only integration tests
test-integration:
pytest tests/integration/ -v

# Run E2E tests (requires example API to be running or will start it)
e2e:
pytest tests/e2e/ -v

# Run linting
lint:
ruff check .
ruff format --check .

# Format code
format:
ruff format .

# Clean generated files
clean:
rm -rf generated_tests/
rm -rf data/
rm -rf test-results/
rm -rf .pytest_cache/
rm -rf __pycache__/
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true

# Build Docker images
docker-build:
docker-compose build

# Run with Docker
docker-up:
docker-compose up

# Stop Docker containers
docker-down:
docker-compose down
Loading