Add SonarQube static code analysis (#671)

This commit is contained in:
Tom M 2020-09-06 23:43:18 +02:00 committed by GitHub
parent 23b270c08b
commit 565002f34f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 2 deletions

View file

@ -2,6 +2,8 @@ language: c
sudo: false
os: linux
dist: focal
git:
depth: false # disable shallow fetch, history is needed by SonarQube
addons:
apt:
update: true
@ -37,6 +39,13 @@ env:
matrix:
include:
- addons:
sonarcloud:
organization: "fluidsynth"
env:
- BW="build-wrapper-linux-x86-64 --out-dir bw-output"
- SONARSC="sonar-scanner -Dsonar.cfamily.build-wrapper-output=build/bw-output"
- arch: arm64
env:
- CC="gcc-7"
@ -84,6 +93,7 @@ before_install:
- echo $PATH
- echo $MATRIX_EVAL
- eval "${MATRIX_EVAL}"
- echo $SONARSC
before_script:
- mkdir $HOME/fluidsynth_install/
@ -91,6 +101,13 @@ before_script:
script:
- cmake -Werror=dev -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 ..
- make -j4
- ${BW} make -j4
- ls -la
- make check
- make install # install only on linux, as CMAKE_INSTALL_PREFIX is ignored for frameworks on macosx and I cant tell whether that's correct or a bug.
- make install
- cd ..
- ${SONARSC}
cache:
directories:
- '$HOME/.sonar/cache'

16
sonar-project.properties Normal file
View file

@ -0,0 +1,16 @@
sonar.projectKey=FluidSynth_fluidsynth
sonar.organization=fluidsynth
sonar.cfamily.threads=4
sonar.cfamily.cache.enabled=false
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=fluidsynth
#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