From 973b64217f022a129fa3b9355bf90ffa80cac258 Mon Sep 17 00:00:00 2001
From: Maximilian Moser <maximilian.moser@tuwien.ac.at>
Date: Mon, 5 Jul 2021 15:34:34 +0200
Subject: [PATCH] Add CI/CD configuration for SonarQube code analysis

---
 .gitlab-ci.yml           | 12 ++++++++++++
 sonar-project.properties |  2 ++
 2 files changed, 14 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 sonar-project.properties

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..3e009c3
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,12 @@
+sonarqube-check:
+  variables:
+    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:
+    key: "${CI_JOB_NAME}"
+    paths:
+      - .sonar/cache
+  script:
+    - sonar-scanner
+  allow_failure: true
+
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0000000..56e49c0
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,2 @@
+sonar.projectKey=fairdata_invenio-utilities_AXp23vwrQz8akf6NDIXV
+sonar.qualitygate.wait=true
-- 
GitLab