2020-08-10 22:14:48 +02:00
|
|
|
image: gcc:6.5
|
2017-06-25 22:05:06 +02:00
|
|
|
|
|
|
|
clone:
|
2020-08-10 22:14:48 +02:00
|
|
|
depth: full # SonarCloud scanner needs the full history to assign issues properly
|
2016-10-17 21:54:12 +02:00
|
|
|
|
2020-08-10 22:14:48 +02:00
|
|
|
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
|
2016-10-17 21:54:12 +02:00
|
|
|
script:
|
2020-08-10 22:14:48 +02:00
|
|
|
- export SONAR_SCANNER_VERSION=4.4.0.2170
|
|
|
|
- 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
|
|
|
|
- export SONAR_SCANNER_OPTS="-server"
|
|
|
|
- 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/sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
|
|
|
|
- export PATH=$HOME/.sonar/sonar/build-wrapper-linux-x86:$PATH
|
2020-08-10 22:26:53 +02:00
|
|
|
- build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT <your clean build command>
|
2020-08-10 22:14:48 +02:00
|
|
|
- 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
|