-
Notifications
You must be signed in to change notification settings - Fork 245
Add code coverage support for Windows and linux platform #1584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Hi @mdboom , |
|
In order to test this before we merge it, I
The job is running here: https://github.com/NVIDIA/cuda-python/actions/runs/21754529128 |
mdboom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great. A lot of hard problems solved here.
I just had the one question about whether we need to do a full clone of the repo. Other than resolving that question, LGTM.
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to fetch the whole history?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, since cuda_bindings and cuda_core both use setuptools_scm to get their version from git history, fetch-depth: 0 is required. Without full history, setuptools_scm may compute an incorrect version, which causes cuda.core.init.py's import-time check to fail with ImportError: cuda.bindings 12.x or 13.x must be installed.
Error like this without fetch-depth:0:
- cd /__w/cuda-python/cuda-python/.venv/lib/python3.14/site-packages
- /__w/cuda-python/cuda-python/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=/__w/cuda-python/cuda-python/.coveragerc /__w/cuda-python/cuda-python/cuda_core/tests
ImportError while loading conftest '/__w/cuda-python/cuda-python/cuda_core/tests/conftest.py'.
../../../../cuda_core/tests/conftest.py:7: in
import helpers
../../../../cuda_core/tests/helpers/init.py:10: in
from cuda.core._utils.cuda_utils import handle_return
cuda/core/init.py:14: in
raise ImportError("cuda.bindings 12.x or 13.x must be installed")
E ImportError: cuda.bindings 12.x or 13.x must be installed
Error: Process completed with exit code 4.
|
/ok to test |
|
| with: | ||
| name: coverage | ||
| name: coverage-combined | ||
| path: docs/coverage/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Does each PR (and that built from main) overwrite with each other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they would overwrite with each other and only keep the latest report in docs/coverage.
The coverage workflow needs to be manually triggered for PR. And for main branch, it was scheduled to be nightly triggered. Current github page report was from this PR because the nightly main coverage run failed and couldn't generate a report.
Historical coverage data is available as artifacts uploaded by each coverage run, with a retention period of 7 days (configurable via retention-days in the workflow).
Do we need to keep historical coverage reports in github pages?
| # Patch cuda_core pyproject.toml - add after cuda.core._cpp line | ||
| sed -i '/\"cuda\.core\._cpp\" = \[\".*\"\]/a \"*\" = [\"*.cpp\"]' cuda_core/pyproject.toml | ||
|
|
||
| echo "Applied coverage patches to cuda_core" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing these patches I think it would be better to add build commands into the projects that need it and pass the options through via pip install --config-settings or using an environment variable.
|
Also, should we consider using something like https://codecov.io instead of manually managing all of the coverage reports? |
This is to add code coverage support for Windows platform.
Here are the main steps: