feat: fix sonarcloud build
[hicn.git] / scripts / run-sonar.sh
1 #!/bin/bash
2
3 # SONAR_HOST_URL=https://sonarcloud.io
4 # PROJECT_KEY=fdio-hicn
5 # PROJECT_ORGANIZATION=fdio
6
7 export SONAR_TOKEN=$API_TOKEN
8 export SONAR_SCANNER_VERSION=4.7.0.2747
9 export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
10 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
11 unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
12 export PATH=$SONAR_SCANNER_HOME/bin:$PATH
13 export SONAR_SCANNER_OPTS="-server"
14 curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
15 unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
16 export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
17
18 cd /workspace
19
20 $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make build
21
22 $SONAR_SCANNER_HOME/bin/sonar-scanner \
23 -Dsonar.organization=$PROJECT_ORGANIZATION \
24 -Dsonar.projectKey=$PROJECT_KEY \
25 -Dsonar.sources=/workspace \
26 -Dsonar.cfamily.build-wrapper-output=bw-output \
27 -Dsonar.host.url=$SONAR_HOST_URL