Skip to content

Commit

Permalink
add workflow for sonarcube (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide authored Feb 18, 2025
1 parent 87d2f03 commit a7c9087
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/sonarcube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Sonarcube Scan
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev libsqlite3-dev
- name: Install googletest
uses: Bacondish2023/setup-googletest@v1

- name: Run Build Wrapper
run: |
mkdir build
cmake -S . -B build
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here
with:
args: >
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ else()
add_definitions(-Wpedantic -fno-omit-frame-pointer)
endif()

# create compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


#---- project configuration ----
option(BTCPP_SHARED_LIBS "Build shared libraries" ON)
Expand Down
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=BehaviorTree_BehaviorTree.CPP
sonar.organization=behaviortree

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=BehaviorTree.CPP
#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 a7c9087

Please sign in to comment.