From de83747b43094f1e2884e516fa29fac37f9837f1 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sat, 16 Aug 2025 22:44:55 +0200 Subject: [PATCH] update CI workflow: integrate code coverage reporting with Codecov and enforce coverage thresholds --- .codecov.yml | 39 ++++++++++++++++++++++++++++++ .github/workflows/reusable-ci.yml | 8 ++++--- README.md | 3 +++ pyproject.toml | 40 ++++++++++++++++++++++++++++++- 4 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..1160767 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,39 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + + status: + project: + default: + target: 70% + threshold: 1% + paths: + - "ovmobilebench/" + patch: + default: + target: 70% + threshold: 1% + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: no + +ignore: + - "tests/" + - "experiments/" + - "**/__pycache__" + - "**/*.pyc" + - "setup.py" \ No newline at end of file diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml index 296ef79..e115a09 100644 --- a/.github/workflows/reusable-ci.yml +++ b/.github/workflows/reusable-ci.yml @@ -45,12 +45,14 @@ jobs: run: mypy ovmobilebench --ignore-missing-imports - name: Run tests - run: pytest tests/ -v --cov=ovmobilebench --cov-report=xml + run: pytest tests/ -v --cov=ovmobilebench --cov-report=xml --cov-report=term-missing - - name: Upload coverage - uses: codecov/codecov-action@v3 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 with: file: ./coverage.xml + flags: unittests + name: codecov-${{ inputs.os }} fail_ci_if_error: false build-package: diff --git a/README.md b/README.md index 6610c3d..4036126 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Python](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) [![CI](https://github.com/embedded-dev-research/OVMobileBench/actions/workflows/bench.yml/badge.svg)](https://github.com/embedded-dev-research/OVMobileBench/actions) +[![codecov](https://codecov.io/gh/embedded-dev-research/OVMobileBench/branch/main/graph/badge.svg)](https://codecov.io/gh/embedded-dev-research/OVMobileBench) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/) **OVMobileBench** is an end-to-end automation pipeline for benchmarking OpenVINO inference performance on mobile devices. It handles the complete workflow from building OpenVINO runtime, packaging models, deploying to devices, executing benchmarks, and generating comprehensive reports. diff --git a/pyproject.toml b/pyproject.toml index adf3c48..5754bb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,4 +49,42 @@ target-version = "py311" [tool.mypy] python_version = "3.11" warn_return_any = true -warn_unused_configs = true \ No newline at end of file +warn_unused_configs = true + +[tool.coverage.run] +source = ["ovmobilebench"] +omit = [ + "*/tests/*", + "*/test_*.py", + "*/__pycache__/*", + "*/site-packages/*", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "if self.debug:", + "if __name__ == .__main__.:", + "raise AssertionError", + "raise NotImplementedError", + "if TYPE_CHECKING:", +] +precision = 2 +show_missing = true +skip_covered = false + +[tool.coverage.html] +directory = "htmlcov" + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py"] +python_classes = ["Test*"] +python_functions = ["test_*"] +addopts = "-v --tb=short --strict-markers" +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')", + "integration: marks tests as integration tests", + "unit: marks tests as unit tests", +] \ No newline at end of file