WIP: fix ci: pass coverage.xml to sonar-scanner #106

Draft
alexoundos wants to merge 5 commits from coverage-for-sonar into master
Collaborator

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 with coverage.xml file inside. Then absolute path to coverage.xml is passed to sonar-scanner. Please, check that sonar-scanner reads coverage.xml correctly.

`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 with `coverage.xml` file inside. Then absolute path to `coverage.xml` is passed to sonar-scanner. Please, check that sonar-scanner reads `coverage.xml` correctly.
inex was assigned by alexoundos 2024-03-18 13:07:34 +02:00
alexoundos added 1 commit 2024-03-18 13:07:35 +02:00
continuous-integration/drone/push Build is passing Details
77c1e70fbc
fix ci: pass coverage.xml to sonar-scanner
alexoundos requested review from houkime 2024-03-18 13:07:39 +02:00
alexoundos changed title from fix ci: pass coverage.xml to sonar-scanner to WIP: fix ci: pass coverage.xml to sonar-scanner 2024-03-18 13:37:27 +02:00
alexoundos force-pushed coverage-for-sonar from 77c1e70fbc to 8d1dc8c58d 2024-03-18 14:13:28 +02:00 Compare
houkime requested changes 2024-03-18 19:54:12 +02:00
.drone.yml Outdated
@ -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)"
Collaborator

Will this command consistently output path? It seems like it should output a lot of other things too.

Will this command consistently output path? It seems like it should output a lot of other things too.
Poster
Collaborator

Yes. It outputs output path to stdout and other stuff to stderr.

Yes. It outputs output path to stdout and other stuff to stderr.
Collaborator

Why asking it to print logs if we only need path?

Why asking it to print logs if we only need path?
Poster
Collaborator

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).

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).
alexoundos force-pushed coverage-for-sonar from 8d1dc8c58d to 34e1f55a7c 2024-03-19 00:58:32 +02:00 Compare
Poster
Collaborator

I've made some changes in the way how coverage is executed. @inex, please, check whether sonar server actually got required data.

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

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
Poster
Collaborator

Last commit produces relative paths for package imports, but absolute path for source code 🤔.

Last commit produces relative paths for package imports, but absolute path for source code 🤔.

Which is not the path the analyzer works on

INFO: Base dir: /tmp/drone-PxoWH3taNAxII8rQ/drone/src

INFO: Working dir: /tmp/drone-PxoWH3taNAxII8rQ/drone/src/.scannerwork
Which is not the path the analyzer works on ``` INFO: Base dir: /tmp/drone-PxoWH3taNAxII8rQ/drone/src INFO: Working dir: /tmp/drone-PxoWH3taNAxII8rQ/drone/src/.scannerwork ```

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

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
alexoundos added 1 commit 2024-04-03 18:43:38 +03:00
continuous-integration/drone/push Build is failing Details
566d9268e1
coverage: replace source absolute path with '.'
alexoundos force-pushed coverage-for-sonar from 566d9268e1 to e60f907720 2024-04-03 19:39:34 +03:00 Compare
alexoundos added 1 commit 2024-04-07 19:46:45 +03:00
continuous-integration/drone/push Build is failing Details
2f7f0d8c0c
WIP: test1
alexoundos force-pushed coverage-for-sonar from 2f7f0d8c0c to 01ab95e1ce 2024-04-07 21:38:20 +03:00 Compare
alexoundos force-pushed coverage-for-sonar from 01ab95e1ce to 9f11396557 2024-04-07 23:14:45 +03:00 Compare
Poster
Collaborator

I replaced absolute path with relative "." using sed.
How is it now?

I replaced absolute path with relative "`.`" using `sed`. How is it now?
alexoundos force-pushed coverage-for-sonar from 9f11396557 to 43a3b71e29 2024-04-14 02:07:35 +03:00 Compare
alexoundos added 1 commit 2024-04-14 02:23:38 +03:00
continuous-integration/drone/push Build is passing Details
943d3a4d7e
WIP: test 2
alexoundos added 1 commit 2024-04-14 13:12:30 +03:00
continuous-integration/drone/push Build is passing Details
d9c56f19b6
WIP: test 3
alexoundos force-pushed coverage-for-sonar from d9c56f19b6 to 88ac422aae 2024-04-16 00:33:25 +03:00 Compare
alexoundos force-pushed coverage-for-sonar from 88ac422aae to 1988460ab7 2024-04-16 05:43:56 +03:00 Compare
Some checks failed
continuous-integration/drone/push Build is failing
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SelfPrivacy/selfprivacy-rest-api#106
There is no content yet.