summaryrefslogtreecommitdiffstats
path: root/scripts/build-sonar.sh
diff options
context:
space:
mode:
authorLuca Muscariello <muscariello@ieee.org>2022-08-08 13:55:31 +0200
committerLuca Muscariello <muscariello@ieee.org>2022-08-10 13:11:09 +0000
commitfb2f16dd7bec77eed4cc9a982890409c29445ab4 (patch)
tree4db78ba4f6244e186537c207ead6a9851cc6253d /scripts/build-sonar.sh
parent012843b1c0bc0838e69085ed83a79ec8b6f97360 (diff)
feat: Sonarcloud
Signed-off-by: Luca Muscariello <muscariello@ieee.org> Change-Id: I2da6c9dfa1d05968555e8f43176de6a0ab37892e
Diffstat (limited to 'scripts/build-sonar.sh')
-rwxr-xr-xscripts/build-sonar.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/build-sonar.sh b/scripts/build-sonar.sh
new file mode 100755
index 000000000..ac1f878b4
--- /dev/null
+++ b/scripts/build-sonar.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# SONAR_HOST_URL=https://sonarcloud.io
+# PROJECT_KEY=fdio_hicn
+# PROJECT_ORGANIZATION=fdio
+
+export SONAR_TOKEN=$API_TOKEN
+export SONAR_SCANNER_VERSION=4.7.0.2747
+export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
+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/build-wrapper-linux-x86.zip -d $HOME/.sonar/
+export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
+
+cd /workspace
+
+$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make build
+
+$SONAR_SCANNER_HOME/bin/sonar-scanner \
+-Dsonar.organization=$PROJECT_ORGANIZATION \
+-Dsonar.projectKey=$PROJECT_KEY \
+-Dsonar.sources=/workspace \
+-Dsonar.cfamily.build-wrapper-output=bw-output \
+-Dsonar.host.url=$SONAR_HOST_URL \ No newline at end of file