Skip to content

Commit 9a4412f

Browse files
authored
[CI/CD] Update coverage config and simplify coverage report script (#1842)
- Added coverage report omit paths to `pyproject.toml`. - Updated `ci/python_coverage_report.sh` to streamline test dependencies installation and reduce redundancy. - Replaced manual test commands with uniform `pytest` commands for better maintainability. This fixes #1825
1 parent 34a4b4a commit 9a4412f

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.github/workflows/sonar-cloud-pipeline.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ jobs:
1414
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
with:
19-
# Fetch all Git history, otherwise the current version number will
20-
# not be correctly calculated.
19+
fetch-tags: true
2120
fetch-depth: 0
2221

22+
- name: Mark repository as safe (Fix for https://github.com/actions/checkout/issues/1048)
23+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
24+
2325
- name: Generate coverage report
2426
run: ci/python_coverage_report.sh
2527

@@ -37,7 +39,7 @@ jobs:
3739
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
3840
steps:
3941
- name: Checkout
40-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4143
with:
4244
# Fetch all Git history, otherwise the current version number will
4345
# not be correctly calculated.

ci/python_coverage_report.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
set -e
44

5-
python -m pip install --user -r requirements.txt -r requirements_gui.txt
65
# Requirements for running the tests on the vfx-platform images
76
python -m pip install coverage pytest-xvfb
87

9-
# Protos need to have their Python code generated in order for tests to pass.
10-
python -m grpc_tools.protoc -I=proto/ --python_out=pycue/opencue/compiled_proto --grpc_python_out=pycue/opencue/compiled_proto proto/*.proto
11-
python -m grpc_tools.protoc -I=proto/ --python_out=rqd/rqd/compiled_proto --grpc_python_out=rqd/rqd/compiled_proto proto/*.proto
12-
python ci/fix_compiled_proto.py pycue/opencue/compiled_proto
13-
python ci/fix_compiled_proto.py rqd/rqd/compiled_proto
8+
pip install ./proto[test] \
9+
./pycue[test] \
10+
./pyoutline[test] \
11+
./cueadmin[test] \
12+
./cueman[test] \
13+
./cuegui[test] \
14+
./cuesubmit[test]
1415

1516
# Run coverage for each component individually, but append it all into the same report.
16-
python -m coverage run --source=pycue/opencue/,pycue/FileSequence/ --omit=pycue/opencue/compiled_proto/* pycue/tests/test_suite.py
17-
PYTHONPATH=pycue python -m coverage run -a --source=pyoutline/outline/ pyoutline/setup.py test
18-
PYTHONPATH=pycue python -m coverage run -a --source=cueadmin/cueadmin/ cueadmin/setup.py test
17+
python -m coverage run -m pytest ./pycue
18+
python -m coverage run -m pytest ./pyoutline
19+
python -m coverage run -m pytest ./cueadmin
20+
python -m coverage run -m pytest ./cueman
21+
python -m coverage run -m pytest ./cuesubmit
1922
# TODO: re-enable cuegui tests when xvfb-run gets configured to execute on the new vfx-platform
20-
# PYTHONPATH=pycue xvfb-run -d python -m coverage run -a --source=cuegui/cuegui/ cuegui/setup.py test
21-
PYTHONPATH=pycue:pyoutline python -m coverage run -a --source=cuesubmit/cuesubmit/ cuesubmit/setup.py test
22-
python -m coverage run -a --source=rqd/rqd/ --omit=rqd/rqd/compiled_proto/* rqd/setup.py test
23+
# python -m coverage run -m pytest ./cuegui
2324

2425
# SonarCloud needs the report in XML.
2526
python -m coverage xml

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[tool.pyright]
22
venvPath = "."
33
venv = "venv"
4+
5+
[tool.coverage.report]
6+
omit = [
7+
"shibokensupport/*",
8+
"signature_bootstrap.py"
9+
]

0 commit comments

Comments
 (0)