Refactored tests and scripts for better modularity and reusability #4
This file contains hidden or 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: Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
env: | |
COVERAGE_PROCESS_START: ${{ github.workspace }}/.coveragerc | |
TESTCONTAINERS_RYUK_DISABLED: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Check Docker is available | |
run: docker ps | |
- name: Run tests with coverage | |
run: | | |
source .venv/bin/activate | |
pytest --cov=producer --cov=consumer --cov-report=xml | |
# Only upload coverage from the main Python version (3.12) | |
- name: Upload coverage to Codecov (only on Python 3.12) | |
if: matrix.python-version == '3.12' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: true |