Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black pytest
pip install -r time_based_storage/requirements-dev.txt
cd time_based_storage && pip install -e .

- name: Check code formatting with black
Expand All @@ -38,6 +38,19 @@ jobs:
flake8 time_based_storage/src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 time_based_storage/tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Run tests
- name: Run tests with coverage
run: |
cd time_based_storage && python -m pytest tests/ -v
cd time_based_storage && python -m pytest tests/ -v --cov=src/time_based_storage --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: johnburbridge/python-time-based-experiment

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}

12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Time-Based Storage System

[![CI](https://github.com/johnburbridge/python-time-based-experiment/actions/workflows/ci.yml/badge.svg)](https://github.com/johnburbridge/python-time-based-experiment/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/johnburbridge/python-time-based-experiment/branch/main/graph/badge.svg)](https://codecov.io/gh/johnburbridge/python-time-based-experiment)

A Python package providing two implementations of a time-based storage system for managing events with timestamps. This library is useful for applications that need to efficiently store and query time-based data, such as event logs, time series data, monitoring systems, and schedulers.

Expand Down Expand Up @@ -180,6 +181,15 @@ cd time_based_storage
python -m pytest tests/ -v
```

Run tests with code coverage:

```bash
cd time_based_storage
python -m pytest tests/ -v --cov=src/time_based_storage --cov-report=html
```

This will generate an HTML coverage report in the `htmlcov` directory.

## Development

### Setup Development Environment
Expand All @@ -190,7 +200,7 @@ cd python-time-based-experiment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e time_based_storage/
pip install pytest black flake8
pip install -r time_based_storage/requirements-dev.txt
```

### Code Style
Expand Down
29 changes: 29 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
codecov:
require_ci_to_pass: true

coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: 80%
threshold: 2%
patch:
default:
target: 80%
threshold: 2%

parsers:
gcov:
branch_detection:
conditional: true
loop: true
method: false
macro: false

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: false
16 changes: 15 additions & 1 deletion time_based_storage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,18 @@ extend-exclude = '''
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
addopts = "-v"
addopts = "-v"

[tool.coverage.run]
source = ["src/time_based_storage"]
omit = ["tests/*"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"pass",
"raise ImportError",
]
5 changes: 5 additions & 0 deletions time_based_storage/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pytest>=7.0.0
black>=23.0.0
flake8>=6.0.0
pytest-cov>=4.0.0
codecov>=2.1.12