diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..f836078a5 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,12 @@ +# Codecov reports coverage, and does not comment or fail a pull request. Only +# "All tests passed" and the PR title are required checks (see CONTRIBUTING.md). +comment: false + +coverage: + status: + project: + default: + informational: true + patch: + default: + informational: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c6dc8137..611a1a4e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,7 +168,7 @@ jobs: key: robot-descriptions-v2-${{ runner.os }}-3.12 - name: Run coverage - run: pytest tests/ --ignore=tests/test_blocks.py --cov=src/roboticstoolbox --cov-report=xml:coverage.xml -q + run: pytest tests/ --ignore=tests/test_blocks.py --cov=roboticstoolbox --cov-report=xml:coverage.xml -q - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: diff --git a/pyproject.toml b/pyproject.toml index f3d4d80ad..afeaab36f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -379,5 +379,26 @@ module = [ ] ignore_errors = true +# CI installs the package and runs the tests against the installed copy, so coverage +# measures it by name. [tool.coverage.paths] maps the installed files back to src/, +# so that the report, and Codecov, use the paths of the repository. [tool.coverage.run] -omit = ["src/roboticstoolbox/demo/*", "test_*.py"] +source = ["roboticstoolbox"] +relative_files = true +omit = ["src/roboticstoolbox/demo/*", "*/roboticstoolbox/demo/*", "test_*.py"] + +[tool.coverage.paths] +source = ["src/roboticstoolbox", "*/site-packages/roboticstoolbox"] + +# Left out of the report, since they have no tests or cannot be measured +[tool.coverage.report] +omit = [ + # sketches for hardware, with no tests, that nobody maintains + "*/roboticstoolbox/backends/Dynamixel/*", + "*/roboticstoolbox/backends/ROS/*", + # the unfinished port of DHFactor, which nothing imports + "*/roboticstoolbox/robot/DHFactor.py", + "*/roboticstoolbox/tools/DHFactor.py", + # the command-line tools run in a subprocess in the tests, which coverage does not trace + "*/roboticstoolbox/bin/*", +]