Skip to content

Commit

Permalink
wip: fix sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Aug 1, 2024
1 parent 6a4fd70 commit 6e79f75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 43 deletions.
49 changes: 7 additions & 42 deletions .gitlab/pipeline/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,32 @@ variables:
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
SONAR_SCANNER_VERSION: 6.1.0.4477-linux-x64

get-sonar-binaries:
stage: .pre
build:
cache:
policy: push
key: "${CI_COMMIT_SHORT_SHA}"
paths:
- build-wrapper/
- sonar-scanner/
script:
- bw-output/
- build/ # the build has to be made available to the sonar-scanner for the analysis
before_script:
- apt-get update -qq
- apt-get install --yes sudo wget build-essential
- apt-get install --yes sudo curl wget build-essential unzip
- ./ci/debian/before_install.sh 6.0-beta1
script:
# Download sonar-scanner
- curl -sSLo ./sonar-scanner.zip "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip"
- unzip -o sonar-scanner.zip
- mv sonar-scanner-${SONAR_SCANNER_VERSION} sonar-scanner
# Download build-wrapper
- curl -sSLo ./build-wrapper-linux-x86.zip "${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip"
- unzip -oj build-wrapper-linux-x86.zip -d ./build-wrapper
only:
- merge_requests
- master
- develop

build:
stage: build
cache:
policy: pull-push
key: "${CI_COMMIT_SHORT_SHA}"
paths:
- build-wrapper/
- sonar-scanner/
- bw-output/
- build/ # the build has to be made available to the sonar-scanner for the analysis
before_script:
- apt-get update -qq
- apt-get install --yes sudo wget build-essential
- ./ci/debian/before_install.sh 6.0-beta1
script:
# prepare the build tree
- CGAL_DIR=$CI_PROJECT_DIR/CGAL cmake -S . -B build -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
# run the build inside the build wrapper
- build-wrapper/build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build/ --config Release
artifacts:
paths:
- build/
only:
- merge_requests
- master
- develop

sonarcloud-check:
stage: .post
cache:
policy: pull
key: "${CI_COMMIT_SHORT_SHA}"
paths:
- build-wrapper/
- sonar-scanner/
- bw-output/
- build/
script:
- sonar-scanner/bin/sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.token="${SONAR_TOKEN}" -Dsonar.cfamily.build-wrapper-output=bw-output
only:
- merge_requests
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sonar.organization=oslandia

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=SFCGAL
sonar.projectVersion=1.5.2
sonar.projectVersion=2.0.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=src
Expand Down

0 comments on commit 6e79f75

Please sign in to comment.