From 12d1f60d630f860e3d5fa7a3b39da2470de1d880 Mon Sep 17 00:00:00 2001
From: Lou Davila <lou.davilapr@hes-so.ch>
Date: Wed, 26 Mar 2025 16:45:00 +0100
Subject: [PATCH] try CD job_quality

---
 .gitlab-ci.yml           | 33 +++++++++++++++++++++++++++++++++
 sonar-project.properties |  2 ++
 2 files changed, 35 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..675f2ee
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,33 @@
+stages:
+  - build
+  - quality
+
+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
+
+default:
+  image: node:lts-slim
+
+build_job:
+  stage: build
+  script: 
+    - npm ci # A la place de npm install
+    - npm run build
+  artifacts:
+    expire_in:
+      - 1 hour
+    paths:
+      - dist/
+
+quality_job:
+  image: leadrien/isc-sonar-scanner-cli:latest
+  stage: quality
+  script:
+  - sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}"
+  cache:
+    policy: pull-push
+    key: "sonar-cache-$CI_COMMIT_REF_SLUG"
+    paths:
+      - "${SONAR_USER_HOME}/cache"
+      - sonar-scanner/
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0000000..6ec939f
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,2 @@
+sonar.projectKey=davila-lou-breakout
+sonar.qualitygate.wait=true
\ No newline at end of file
-- 
GitLab