3 # Run SonarQube on travis. First version was given per email by one of the SonarQube engineer.
5 # Install required software
6 installSonarQubeScanner() {
7 export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-2.6
8 rm -rf $SONAR_SCANNER_HOME
9 mkdir -p $SONAR_SCANNER_HOME
10 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
11 unzip $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
12 rm $HOME/.sonar/sonar-scanner.zip
13 export PATH=$SONAR_SCANNER_HOME/bin:$PATH
14 export SONAR_SCANNER_OPTS="-server"
16 installBuildWrapper() {
17 curl -LsS https://nemo.sonarqube.org/static/cpp/build-wrapper-linux-x86.zip > build-wrapper-linux-x86.zip
18 unzip build-wrapper-linux-x86.zip
20 installSonarQubeScanner
23 # triggers the compilation through the build wrapper to gather compilation database
24 # 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)
25 # Plus, we need to activate MC so that it does not get throught the quality net :)
27 cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_model-checking=ON -Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF .
28 ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make all
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