From 79d12cbbb009f2f34b3ad15fff953cd3996e79e6 Mon Sep 17 00:00:00 2001
From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr>
Date: Thu, 12 Nov 2020 19:30:18 +0100
Subject: [PATCH] modification for sonar to handle coverage

---
 .gitignore               | 2 ++
 .gitlab-ci.yml           | 3 ++-
 sonar-project.properties | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index f70114a..c92a2e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@ src/__pycache__/
 .coverage
 src/gc_content/__pycache__/
 tests/files/test_genome.fa.fai
+coverage.xml
+.scannerwork/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ea70f87..be1ff4e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,6 +18,7 @@ tests:
     - pip install biopython==1.75
   script:
     - coverage run -m unittest discover
+    - coverage report xml
 
 sonarqube-check:
   image:
@@ -25,7 +26,7 @@ sonarqube-check:
     entrypoint: [ "" ]
   variables:
     SONAR_TOKEN: ae2c1731888a2155e90ea0a1dcec551c8d4336bd
-    SONAR_HOST_URL: http://192.168.1.58:9000/
+    SONAR_HOST_URL: http://192.168.1.58:9000/ # You have to not use localhost otherwise it will not work
     SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
     GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
   cache:
diff --git a/sonar-project.properties b/sonar-project.properties
index cfeb631..4154224 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -10,6 +10,7 @@ sonar.sources=.
 # Encoding of the source code. Default is default system encoding
 sonar.sourceEncoding=UTF-8
 #Description of the project
+sonar.python.coverage.reportPaths=./coverage.xml
 sonar.projectDescription=A tools to visualise bigwig coverage.
 #----- Default SonarQube server
 #sonar.host.url=http://localhost:9000
\ No newline at end of file
-- 
GitLab