fix ci: pass coverage.xml to sonar-scanner
continuous-integration/drone/push Build is passing Details

coverage-for-sonar
Alexander 2024-03-18 14:38:26 +04:00
parent 962e8d5ca7
commit 34e1f55a7c
2 changed files with 5 additions and 5 deletions

View File

@ -5,8 +5,8 @@ name: default
steps:
- name: Run Tests and Generate Coverage Report
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)"
- sonar-scanner -Dsonar.projectKey=SelfPrivacy-REST-API -Dsonar.sources=. -Dsonar.host.url=http://analyzer.lan:9000 -Dsonar.login="$SONARQUBE_TOKEN" -Dsonar.python.coverage.reportPaths="$VM_TEST_OUT_PATH/coverage.xml" -Dsonar.python.version=3.10
environment:
SONARQUBE_TOKEN:
from_secret: SONARQUBE_TOKEN

View File

@ -150,9 +150,9 @@
testScript = ''
start_all()
machine.succeed("cd ${vmtest-src-dir} && coverage run --data-file=/tmp/.coverage -m pytest -p no:cacheprovider -v >&2")
machine.succeed("coverage xml --rcfile=${vmtest-src-dir}/.coveragerc --data-file=/tmp/.coverage >&2")
machine.copy_from_vm("coverage.xml", ".")
machine.succeed("coverage report >&2")
machine.succeed("cd ${vmtest-src-dir} && coverage xml --data-file=/tmp/.coverage -o /tmp/coverage.xml >&2")
machine.copy_from_vm("/tmp/coverage.xml", ".")
machine.succeed("coverage report --rcfile=.coveragerc --data-file=/tmp/.coverage >&2")
'';
};
};