Skip to content

Commit bac92f9

Browse files
cguarinosuclaude
andcommitted
ci: Add GitHub Actions workflow for Python testing
Implement comprehensive CI/CD pipeline with GitHub Actions to ensure code quality and test coverage across multiple Python versions. Workflow features: - Multi-version testing (Python 3.9, 3.10, 3.11, 3.12, 3.13) - Triggers on push and pull requests - Matrix strategy for parallel execution Quality checks: 1. Linting with Ruff - Fast Rust-based linter - Catches common errors and code smells 2. Format verification with Ruff - Ensures consistent code style - Fails if code not formatted 3. Type checking with mypy - Strict type validation - Catches type errors before runtime 4. Unit tests with pytest - Full test suite execution - Coverage reporting (XML and terminal) - Verbose output for debugging 5. Code coverage upload - Uploads to Codecov (Python 3.13 only) - Tracks coverage trends over time - Non-blocking for CI Dependencies updated: - Added pytest-cov for coverage reporting - Updated to Poetry-based workflow - Uses official GitHub Actions (v4/v5) Benefits: - Catch bugs before merge - Ensure compatibility across Python versions - Maintain code quality standards - Track test coverage metrics - Fast feedback loop for developers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 2e704c7 commit bac92f9

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install Poetry
22+
run: |
23+
curl -sSL https://install.python-poetry.org | python3 -
24+
echo "$HOME/.local/bin" >> $GITHUB_PATH
25+
26+
- name: Install dependencies
27+
run: poetry install
28+
29+
- name: Run linting with Ruff
30+
run: poetry run ruff check .
31+
32+
- name: Run formatting check with Ruff
33+
run: poetry run ruff format --check .
34+
35+
- name: Run type checking with mypy
36+
run: poetry run mypy app/
37+
38+
- name: Run tests with pytest
39+
run: poetry run pytest -v --cov=app --cov-report=xml --cov-report=term
40+
41+
- name: Upload coverage to Codecov
42+
if: matrix.python-version == '3.13'
43+
uses: codecov/codecov-action@v4
44+
with:
45+
file: ./coverage.xml
46+
fail_ci_if_error: false

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pydantic-settings = "^2.6.0"
1616
[tool.poetry.group.dev.dependencies]
1717
pytest = "^8.3.0"
1818
pytest-asyncio = "^0.24.0"
19+
pytest-cov = "^6.0.0"
1920
httpx = "^0.27.0"
2021
ruff = "^0.7.0"
2122
mypy = "^1.13.0"

0 commit comments

Comments
 (0)