Skip to content

Commit

Permalink
Implement sonar scanning.
Browse files Browse the repository at this point in the history
  • Loading branch information
ASxa86 committed Aug 14, 2024
1 parent a1bb028 commit 24b3bf5
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
49 changes: 46 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,31 @@ variables:
# Configure NuGet
- mono ${NUGET_COMMAND} sources add -source ${NUGET_SOURCE} -name ${NUGET_NAME} -username gitlab-ci-token -password $CI_JOB_TOKEN

build-clang-tidy:
get-sonar-binaries:
image: $CI_REGISTRY/asxa86/images/ubuntu-dev:latest
stage: build
stage: .pre
cache:
policy: push
key: "${CI_COMMIT_SHORT_SHA}"
paths:
- build-wrapper/
- sonar-scanner/
script:
# Download sonar-scanner
- curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip'
- unzip -o sonar-scanner.zip
- mv sonar-scanner-6.1.0.4477-linux-x64 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

lint-clang-tidy:
image: $CI_REGISTRY/asxa86/images/ubuntu-dev:latest
stage: lint
needs: []
tags:
# - saas-linux-medium-amd64
Expand Down Expand Up @@ -86,4 +108,25 @@ build-android-armg64-debug:
image: $CI_REGISTRY/asxa86/images/android-build:latest
extends: .build-base
variables:
CMAKE_PRESET: android-arm64-debug
CMAKE_PRESET: android-arm64-debug

build-gcc-debug-sonar:
stage: build
cache:
policy: pull-push
key: "${CI_COMMIT_SHORT_SHA}"
paths:
- build-wrapper/
- sonar-scanner/
variables:
CMAKE_PRESET: gcc-debug
script:
- ${CMAKE_COMMAND} --preset ${CMAKE_PRESET}
# Run the build inside the build wrapper
- build-wrapper/build-wrapper-linux-x86-64 --out-dir bw-output ${CMAKE_COMMAND} --build --preset ${CMAKE_PRESET}
# Run the sonar-scanner in the same stage as the build
- sonar-scanner/bin/sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.token="${SONAR_TOKEN}" -Dsonar.cfamily.compile-commands=bw-output/compile_commands.json
only:
- merge_requests
- master
- develop
13 changes: 13 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sonar.projectKey=asxa86_aspire
sonar.organization=asxa86

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=aspire
#sonar.projectVersion=1.0


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

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

0 comments on commit 24b3bf5

Please sign in to comment.