From 34e1f55a7c75895d73e48f24fe6a708f48ff9873 Mon Sep 17 00:00:00 2001 From: Alexander Tomokhov Date: Mon, 18 Mar 2024 14:38:26 +0400 Subject: [PATCH] fix ci: pass coverage.xml to sonar-scanner --- .drone.yml | 4 ++-- flake.nix | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2be4c77..55595e9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 diff --git a/flake.nix b/flake.nix index fee8e79..5335029 100644 --- a/flake.nix +++ b/flake.nix @@ -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") ''; }; };