From 9a20c1a959458bd16a27b00d9948964ca5edd6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Tue, 27 Feb 2024 16:51:46 +0100 Subject: [PATCH] CI/CD => Add sonar integration --- .../.gitlab-ci/04_stageCodeQuality.yml | 22 ++++++++++++++++++- sonar-project.properties | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 sonar-project.properties diff --git a/ExerciseChecker/.gitlab-ci/04_stageCodeQuality.yml b/ExerciseChecker/.gitlab-ci/04_stageCodeQuality.yml index 48f2394..c10eae8 100644 --- a/ExerciseChecker/.gitlab-ci/04_stageCodeQuality.yml +++ b/ExerciseChecker/.gitlab-ci/04_stageCodeQuality.yml @@ -5,8 +5,28 @@ code_quality:lint: image: node:latest script: - cd "${PROJECT_FOLDER}" - + - npm install - npm run lint rules: - if: '$CI_COMMIT_TAG =~ "/^$/"' + + +code_quality:sonarqube: + stage: code_quality + tags: + - code_quality + image: + name: leadrien/isc-sonar-scanner-cli + 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: + - .sonar/cache + script: + - sonar-scanner + rules: + - if: '$CI_COMMIT_TAG =~ "/^$/"' diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..14ae2bb --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.projectKey=DojoExerciseChecker +sonar.qualitygate.wait=true -- GitLab