Skip to content

Commit 1d5efb2

Browse files
author
“jagnd1”
committed
FIX: force relative paths in coverage.xml
ISSUE: coverage.xml still contains absolute paths despite relative_files=True ROOT CAUSE: pytest --cov=../ overrides .coveragerc relative_files setting SOLUTION: explicit sed commands to convert absolute to relative paths This is the final fix based on evidence from logs showing: - filename="/home/runner/work/fmcrypto/fmcrypto/common/__init__.py" - needs to become: filename="common/__init__.py" Added verification step to confirm path fix works. This MUST resolve the SonarCloud coverage detection issue.
1 parent 18f57c4 commit 1d5efb2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/sonarcloud.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,22 @@ jobs:
106106
export PROTOCOL="http"
107107
export PYTHONPATH="../:$PYTHONPATH"
108108
109-
# Official SonarCloud recommended command structure
109+
# Generate coverage with proper relative paths for SonarCloud
110110
pytest unit_tests/ integration_tests/ e2e_tests/ \
111111
--cov=../crypto_service \
112112
--cov=../pki_service \
113113
--cov=../common \
114114
--cov-report=xml:coverage.xml \
115115
--junitxml=test-results.xml \
116116
-v
117+
118+
# CRITICAL: Fix absolute paths to relative paths for SonarCloud
119+
sed -i 's|filename="/home/runner/work/fmcrypto/fmcrypto/|filename="|g' coverage.xml
120+
sed -i 's|filename="home/runner/work/fmcrypto/fmcrypto/|filename="|g' coverage.xml
121+
122+
# Verify the fix worked
123+
echo "=== Verifying path fix ==="
124+
grep 'filename=' coverage.xml | head -3
117125
118126
- name: stop services
119127
if: always()

0 commit comments

Comments
 (0)