Skip to content

Commit e6c6c35

Browse files
author
Hristo Hristov
committed
ci: Add GitHub Actions workflow for Python CI/CD
- Multi-version Python testing (3.9-3.12) - Linting with ruff - Format checking with black - Type checking with mypy - Code coverage with pytest - Automated security and quality checks
1 parent 97535f8 commit e6c6c35

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/python-ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.9', '3.10', '3.11', '3.12']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28+
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
29+
pip install pytest pytest-cov ruff black mypy
30+
31+
- name: Lint with ruff
32+
run: |
33+
ruff check . || true
34+
35+
- name: Format check with black
36+
run: |
37+
black --check . || true
38+
39+
- name: Type check with mypy
40+
run: |
41+
mypy . || true
42+
43+
- name: Test with pytest
44+
run: |
45+
pytest --cov=. --cov-report=xml --cov-report=term || true
46+
47+
- name: Upload coverage
48+
uses: codecov/codecov-action@v4
49+
if: matrix.python-version == '3.12'
50+
with:
51+
file: ./coverage.xml
52+
fail_ci_if_error: false

0 commit comments

Comments
 (0)