diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13da6572f23595215ee52e09eee144c8a12324b3..c9019640072c9b08c7eb08bb5e0b6fcf58c54011 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,6 @@ stages: - pre - build - analyze - - validate - deploy # git config --global have been added to get around the issue related in @@ -21,6 +20,5 @@ include: - .gitlab/build.yml - .gitlab/coverity.yml - .gitlab/sonarqube.yml - - .gitlab/validate.yml - .gitlab/pages.yml - .gitlab/release.yml diff --git a/.gitlab/sonarqube.yml b/.gitlab/sonarqube.yml index 31c3cd0f23e1e5b3fbc0a8adff5196beb9bddf9d..32c9a059cb7f99d68a092eb69190e6ea629eaf8f 100644 --- a/.gitlab/sonarqube.yml +++ b/.gitlab/sonarqube.yml @@ -17,6 +17,8 @@ sonarqube: needs: [build] script: - ${CI_PROJECT_DIR}/tools/analysis.sh + variables: + GIT_DEPTH: "0" artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" expire_in: 180 minutes diff --git a/.gitlab/validate.sh b/.gitlab/validate.sh deleted file mode 100755 index fb77b471229bcece240813b9cdafd419d6860017..0000000000000000000000000000000000000000 --- a/.gitlab/validate.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -### -# -# @file validate.sh -# @copyright 2023-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, -# Univ. Bordeaux. All rights reserved. -# -# @version 1.2.0 -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 2023-12-07 -# -### - -# Check some metrics on sonarqube (https://sonarqube.inria.fr/sonarqube/) -# and depending on the value return 0 (success) or 1 (failure). - -if [ $# -gt 0 ]; then - METRIC=$1 -fi -METRIC=${METRIC:-BUG} - -if [[ -z $CI_MERGE_REQUEST_IID || -z $CI_PROJECT_NAMESPACE || -z $CI_PROJECT_NAME ]]; then - echo """ -ERROR: One of the variables CI_MERGE_REQUEST_IID, CI_PROJECT_NAMESPACE, - CI_PROJECT_NAME is empty. This script must be used during a gitlab merge - request only -> Failure. -""" - exit 1 -fi - -if [[ -z $SONARQUBE_LOGIN ]]; then - echo """ -ERROR: SONARQUBE_LOGIN is empty, please give a valid sonarqube user's token, - with permissions set on the project -> Failure. -""" - exit 1 -fi - -if [[ $METRIC == "BUG" ]]; then - BUG=`curl -u $SONARQUBE_LOGIN: -X GET "https://sonarqube.inria.fr/sonarqube/api/measures/component?component=${CI_PROJECT_NAMESPACE}%3A${CI_PROJECT_NAME}&pullRequest=${CI_MERGE_REQUEST_IID}&metricKeys=new_bugs" |jq '.component.measures[0].period.value' | sed -e "s#\"##g"` - echo "BUG=$BUG" - if [[ $BUG -gt 0 ]]; then - echo "%{BUG} new bugs detected by Sonarqube -> Failure." - exit 1 - else - echo "No new bugs detected by Sonarqube -> Success." - exit 0 - fi -elif [[ $METRIC == "COVERAGE" ]]; then - COV=`curl -u $SONARQUBE_LOGIN: -X GET "https://sonarqube.inria.fr/sonarqube/api/measures/component?component=${CI_PROJECT_NAMESPACE}%3A${CI_PROJECT_NAME}&pullRequest=${CI_MERGE_REQUEST_IID}&metricKeys=new_coverage" |jq '.component.measures[0].period.value' | sed -e "s#\"##g" | cut -d "." -f 1` - echo "COV=$COV" - if [[ $COV == "null" || -z $COV ]]; then - echo "Coverage is empty, certainly that there are no lines of new code (considered during the analysis) to compare -> Success." - else - if [[ $COV -lt 80 ]]; then - echo "Coverage on new lines is ${COV}%, which is < 80% -> Failure." - exit 1 - else - echo "Coverage on new lines is ${COV}%, which is >= 80% -> Success." - exit 0 - fi - fi -fi diff --git a/.gitlab/validate.yml b/.gitlab/validate.yml deleted file mode 100644 index ecd5f8feb342e6541b8bf64fa24e0e21d8b91291..0000000000000000000000000000000000000000 --- a/.gitlab/validate.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -validate: - stage: validate - tags: ["docker"] - extends: .only-mr - needs: [sonarqube] - parallel: - matrix: - - METRIC: [BUG] - script: - - ./.gitlab/validate.sh $METRIC - allow_failure: true diff --git a/tools/analysis.sh b/tools/analysis.sh index 201b4c69409448311276a71bc42c979d0c744bf7..81ee07c7cadbb6869e584a7a4779adcad7ccf09d 100755 --- a/tools/analysis.sh +++ b/tools/analysis.sh @@ -39,14 +39,14 @@ cppcheck -v -f --language=c++ --platform=unix64 --enable=all --xml --xml-version # create the sonarqube config file cat > sonar-project.properties << EOF sonar.host.url=https://sonarqube.inria.fr/sonarqube -sonar.login=$SONARQUBE_LOGIN +sonar.qualitygate.wait=true sonar.links.homepage=$CI_PROJECT_URL sonar.links.scm=$CI_REPOSITORY_URL sonar.links.ci=$CI_PROJECT_URL/pipelines sonar.links.issue=$CI_PROJECT_URL/issues -sonar.projectKey=${CI_PROJECT_NAMESPACE}:${CI_PROJECT_NAME} +sonar.projectKey=solverstack_vite_AZJl-7lOsbMNg1jXgz2T sonar.projectDescription=Visual Trace Explorer sonar.projectVersion=1.3.0