Skip to content

Commit fb3eacd

Browse files
committed
Added GitHub Actions workflow for Python tests and Codecov integration
- Introduced `.github/workflows/python.yml` to run tests on main branch pushes and PRs - Enabled test matrix for Python 3.10, 3.11, 3.12, and 3.13 - Configured test coverage reporting with Codecov - Updated README with GitHub Actions and Codecov badges
1 parent da703de commit fb3eacd

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/python.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
16+
17+
env:
18+
COVERAGE_PROCESS_START: ${{ github.workspace }}/.coveragerc
19+
TESTCONTAINERS_RYUK_DISABLED: true
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m venv .venv
32+
source .venv/bin/activate
33+
pip install -r requirements.txt
34+
pip install -r requirements-dev.txt
35+
36+
- name: Check Docker is available
37+
run: docker ps
38+
39+
- name: Run tests with coverage
40+
run: |
41+
source .venv/bin/activate
42+
pytest --cov=producer --cov=consumer --cov-report=xml
43+
44+
# Only upload coverage from the main Python version (3.12)
45+
- name: Upload coverage to Codecov (only on Python 3.12)
46+
if: matrix.python-version == '3.12'
47+
uses: codecov/codecov-action@v4
48+
with:
49+
token: ${{ secrets.CODECOV_TOKEN }}
50+
files: ./coverage.xml
51+
fail_ci_if_error: true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[![Author](https://img.shields.io/badge/Author-Vadim%20Starichkov-blue?style=for-the-badge)](https://github.com/starichkov)
2+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/starichkov/kafka-python-demo/python.yml?style=for-the-badge)](https://github.com/starichkov/kafka-python-demo/actions/workflows/python.yml)
3+
[![Codecov](https://img.shields.io/codecov/c/github/starichkov/kafka-python-demo?style=for-the-badge)](https://codecov.io/gh/starichkov/kafka-python-demo)
24
[![GitHub License](https://img.shields.io/github/license/starichkov/kafka-python-demo?style=for-the-badge)](https://github.com/starichkov/kafka-python-demo/blob/main/LICENSE.md)
35

46
# Apache Kafka Python Demo

0 commit comments

Comments
 (0)