Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use env for perl in this script
[simgrid.git] / tools / internal / travis-sonarqube.sh
1 #! /bin/sh
2
3 # Run SonarQube on travis. First version was given per email by one of the SonarQube engineer.
4
5 set -ex
6
7 # Install required software
8 installSonarQubeScanner() {
9   export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-2.6
10   rm -rf $SONAR_SCANNER_HOME
11   mkdir -p $SONAR_SCANNER_HOME
12   curl -sSLo $HOME/.sonar/sonar-scanner.zip http://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/2.6/sonar-scanner-cli-2.6.zip
13   unzip $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
14   rm $HOME/.sonar/sonar-scanner.zip
15   export PATH=$SONAR_SCANNER_HOME/bin:$PATH
16   export SONAR_SCANNER_OPTS="-server"
17 }
18 installBuildWrapper() {
19   curl -LsS https://nemo.sonarqube.org/static/cpp/build-wrapper-linux-x86.zip > build-wrapper-linux-x86.zip
20   unzip build-wrapper-linux-x86.zip
21 }
22 installSonarQubeScanner
23 installBuildWrapper
24
25 # triggers the compilation through the build wrapper to gather compilation database
26 # We need to clean the build that was used for the tests before to ensure that everything gets rebuilt (sonarqube only use what's built throught its wrappers)
27 # Plus, we need to activate MC so that it does not get throught the quality net :)
28 ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make VERBOSE=1
29
30 # and finally execute the actual SonarQube analysis (the SONAR_TOKEN is set from the travis web interface, to not expose it)
31 sonar-scanner -Dsonar.host.url=https://nemo.sonarqube.org -Dsonar.login=$SONAR_TOKEN