Ray Milkey | 20d2252 | 2017-11-08 10:55:52 -0800 | [diff] [blame] | 1 | #!/bin/bash -ex |
Ray Milkey | cb569c3 | 2017-12-12 13:42:20 -0800 | [diff] [blame] | 2 | |
| 3 | # exit on errors |
| 4 | set -eu -o pipefail |
| 5 | |
Ray Milkey | 20d2252 | 2017-11-08 10:55:52 -0800 | [diff] [blame] | 6 | ONOS_ROOT=`pwd` |
| 7 | . tools/build/envDefaults |
| 8 | |
Ray Milkey | faa66c9 | 2017-11-08 12:58:43 -0800 | [diff] [blame] | 9 | # download and install Sonar scanner |
Ray Milkey | b3f5244 | 2017-11-08 12:22:54 -0800 | [diff] [blame] | 10 | SONAR_SCANNER_VERSION=3.0.3.778 |
Ray Milkey | abba832 | 2017-11-08 12:03:58 -0800 | [diff] [blame] | 11 | curl -L -o /tmp/sonar-scanner-cli.zip -X GET https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip |
Ray Milkey | 20d2252 | 2017-11-08 10:55:52 -0800 | [diff] [blame] | 12 | unzip /tmp/sonar-scanner-cli.zip |
Ray Milkey | faa66c9 | 2017-11-08 12:58:43 -0800 | [diff] [blame] | 13 | |
| 14 | # Configure ONOS specific properties |
Andrew Grimberg | 6ecb1b1 | 2017-11-16 14:42:39 -0800 | [diff] [blame] | 15 | echo "sonar.host.url=https://sonar.onosproject.org" >>sonar-scanner-$SONAR_SCANNER_VERSION/conf/sonar-scanner.properties |
Ray Milkey | 20d2252 | 2017-11-08 10:55:52 -0800 | [diff] [blame] | 16 | |
Ray Milkey | 04e6f5e | 2017-11-08 13:14:11 -0800 | [diff] [blame] | 17 | # Be sure buck is installed |
| 18 | onos-buck --version |
| 19 | |
Ray Milkey | faa66c9 | 2017-11-08 12:58:43 -0800 | [diff] [blame] | 20 | # Generate coverage data |
| 21 | tools/build/onos-prepare-sonar |
| 22 | |
| 23 | # Upload coverage to Sonar |
Ray Milkey | abba832 | 2017-11-08 12:03:58 -0800 | [diff] [blame] | 24 | sonar-scanner-$SONAR_SCANNER_VERSION/bin/sonar-scanner |
Ray Milkey | 20d2252 | 2017-11-08 10:55:52 -0800 | [diff] [blame] | 25 | |
| 26 | |