From 91185887674e50615fd1972334299f89e2468324 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Schr=C3=B6tler?= <niklas@allround.digital>
Date: Thu, 10 Aug 2023 20:56:37 +0200
Subject: [PATCH] Added SonarQube Quality Testing I will hate myself for this

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8caf39b..6f913c3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,17 +1,35 @@
 image: alpine:latest
 
-pages:
-  stage: deploy
-  script:
-  - mkdir public
-  - mv js public/js
-  - mv css public/css
-  - mv panels public/panels
-  - mv config public/config
-  - mv index.html public/index.html
-  - mv favicon.png public/favicon.png 
-  artifacts:
+sonarqube-check:
+  image:
+    name: sonarsource/sonar-scanner-cli:latest
+    entrypoint: [""]
+  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:
-    - public/
-  only:
-  - master
+      - .sonar/cache
+  script:
+    - sonar-scanner
+  allow_failure: true
+  rules:
+    - if: $CI_COMMIT_BRANCH == 'master'
+
+
+#pages:
+#  stage: deploy
+#  script:
+#  - mkdir public
+#  - mv js public/js
+#  - mv css public/css
+#  - mv panels public/panels
+#  - mv config public/config
+#  - mv index.html public/index.html
+#  - mv favicon.png public/favicon.png
+#  artifacts:
+#    paths:
+#    - public/
+#  only:
+#  - master
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0000000..7b01ac3
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,2 @@
+sonar.projectKey=Fachschaft-Informatik-Infoscreen
+sonar.qualitygate.wait=true
-- 
GitLab