fix: improve type safety and mypy configuration - Add type-safe wrapp… #18
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
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Create venv and install dependencies | |
run: | | |
uv venv | |
. .venv/bin/activate | |
uv pip install -r requirements.txt | |
- name: Lint with Ruff | |
run: | | |
. .venv/bin/activate | |
uv pip install ruff | |
.venv/bin/ruff check . | |
- name: Format with Ruff | |
run: | | |
. .venv/bin/activate | |
.venv/bin/ruff format --check . | |
- name: Type check with mypy | |
run: | | |
. .venv/bin/activate | |
uv pip install mypy | |
.venv/bin/mypy . | |
test: | |
runs-on: ubuntu-latest | |
needs: lint | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Create venv and install dependencies | |
run: | | |
uv venv | |
. .venv/bin/activate | |
uv pip install -r requirements.txt | |
uv pip install pytest pytest-asyncio pytest-cov | |
- name: Run tests | |
env: | |
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
LANGFUSE_PUBLIC_KEY: ${{ secrets.LANGFUSE_PUBLIC_KEY }} | |
LANGFUSE_SECRET_KEY: ${{ secrets.LANGFUSE_SECRET_KEY }} | |
LANGFUSE_HOST: ${{ secrets.LANGFUSE_HOST }} | |
run: | | |
. .venv/bin/activate | |
.venv/bin/pytest -v |