WIP: fix ci: pass coverage.xml to sonar-scanner #106
No reviewers
Labels
No Label
Bug
Contributions welcome
Did not do
Duplicate
Feature
Module
Backups
Module
GraphQL
Priority
High
Priority
Low
Priority
Medium
Refactor
Severity
High
Severity
Low
Severity
Medium
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: SelfPrivacy/selfprivacy-rest-api#106
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "coverage-for-sonar"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
nix build .#checks.x86_64-linux.default --no-link --print-out-paths --print-build-logs
command outputs a /nix/store/... path after test finishes successfully. This path is a directory withcoverage.xml
file inside. Then absolute path tocoverage.xml
is passed to sonar-scanner. Please, check that sonar-scanner readscoverage.xml
correctly.fix ci: pass coverage.xml to sonar-scannerto WIP: fix ci: pass coverage.xml to sonar-scanner77c1e70fbc
to8d1dc8c58d
@ -7,3 +7,2 @@
commands:
- nix flake check -L
- sonar-scanner -Dsonar.projectKey=SelfPrivacy-REST-API -Dsonar.sources=. -Dsonar.host.url=http://analyzer.lan:9000 -Dsonar.login="$SONARQUBE_TOKEN"
- VM_TEST_OUT_PATH="$(nix build .#checks.x86_64-linux.default --no-link --print-out-paths --print-build-logs)"
Will this command consistently output path? It seems like it should output a lot of other things too.
Yes. It outputs output path to stdout and other stuff to stderr.
Why asking it to print logs if we only need path?
For us to see what pytest/coverage prints (lines with test name and percentage). Otherwise, it's silent about progress and it's especially tedious having tests running so slowly (~25 minutes).
8d1dc8c58d
to34e1f55a7c
I've made some changes in the way how
coverage
is executed. @inex, please, check whether sonar server actually got required data.Still no luck. Can we take a look at generated
coverage.xml
files?https://community.sonarsource.com/t/sonarqube-python-code-coverage-show-0/29792/3
Looks like it expects relative paths there
Last commit produces relative paths for package imports, but absolute path for source code 🤔.
Which is not the path the analyzer works on
https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747/6
Probably we should modify the report.xml to fix the path
566d9268e1
toe60f907720
2f7f0d8c0c
to01ab95e1ce
01ab95e1ce
to9f11396557
I replaced absolute path with relative "
.
" usingsed
.How is it now?
9f11396557
to43a3b71e29
d9c56f19b6
to88ac422aae
88ac422aae
to1988460ab7