From bdc19e9032b84b7dfd1836343895390b710887fc Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Fri, 25 Jul 2025 17:23:18 +0100 Subject: [PATCH] - added bitbucket pipeline; cppcheck with XML output --- Makefile | 2 +- bitbucket-pipelines.yml | 39 +++++++++++++++++++++++++++++++++++++++ sonar-project.properties | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 bitbucket-pipelines.yml create mode 100644 sonar-project.properties diff --git a/Makefile b/Makefile index d81bf485..f8836cb1 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ static_checks: lib splint -preproc +posixlib +skip-sys-headers +gnuextensions $(LIB_INCLUDES) $(LIB_SOURCES) cppcheck: lib - cppcheck --force --std=c99 --enable=all $(LIB_INCLUDES) $(LIB_SOURCES) 2> cppcheck-output.xml + cppcheck --force --std=c99 --xml --enable=all $(LIB_INCLUDES) $(LIB_SOURCES) 2> cppcheck-output.xml lib: $(LIB_NAME) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml new file mode 100644 index 00000000..e9e874f2 --- /dev/null +++ b/bitbucket-pipelines.yml @@ -0,0 +1,39 @@ +image: gcc:10.2 + +clone: + depth: full # SonarCloud scanner needs the full history to assign issues properly + +definitions: + caches: + sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build + steps: + - step: &build-test-sonarcloud + name: Build, test and analyze on SonarCloud + caches: + - sonar + script: + - export SONAR_SCANNER_VERSION=5.0.1.3006 + - export SONAR_SCANNER_OPTS="-Dsonar.javaHome=/usr/lib/jvm/java-17-openjdk-amd64" + - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux + - export BW_OUTPUT=$HOME/.sonar/bw-output + - mkdir -p $BW_OUTPUT + - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip + - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ + - export PATH=$SONAR_SCANNER_HOME/bin:$PATH + - curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip + - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ + - export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH + - apt-get update -qq + - apt-get install cmake -y --force-yes + - mkdir build + - cmake . -Bbuild + - build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT cmake --build build + - sonar-scanner -Dsonar.cfamily.build-wrapper-output=$BW_OUTPUT + +pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html + branches: + master: + - step: *build-test-sonarcloud + pull-requests: + '**': + - step: *build-test-sonarcloud \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..a484b784 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.sources=src,hal \ No newline at end of file