I would like to ask why is the code coverage report does not match the result in Github Action.
I ran the following
- name: Test with django
run: |
source venv/bin/activate
coverage run --source='.' manage.py test
coverage report
coverage html
coverage xml -o coverage_report/coverage.xml
deactivate
- name: Override Coverage Source Path for Sonar
run: sed -i "s/<source>\/home\/runner\/work\/hre-ml\/hre-ml<\/source>/<source>\/github\/workspace<\/source>/g" /home/runner/work/hre-ml/hre-ml/coverage_report/coverage.xml
- name: archive coverage results
uses: actions/upload-artifact@v1
with:
name: coverage-report
path: coverage_report
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Result from Github Action:
TOTAL 2081 824 60.40%
Wrote HTML report to coverage_report/index.html
Wrote XML report to coverage_report/coverage.xml
But in SonarCloud Dashboard,
It only show 43.8% under “Overall Code”.
Just wondering why it doesn’t match the result from the coverage report.