Skip to content

Commit

Permalink
Merge pull request #7 from usdot-fhwa-stol/feature/code_coverage
Browse files Browse the repository at this point in the history
Add code coverage to sonar cloud ci
  • Loading branch information
kjrush authored May 8, 2019
2 parents 0c4ffed + 469c28b commit a8b902b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ jobs:
name: Build Driver
command: |
source ${INIT_ENV}
build-wrapper-linux-x86-64 --out-dir /opt/carma/bw-output catkin_make install -j 2
build-wrapper-linux-x86-64 --out-dir /opt/carma/bw-output bash make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov
- run:
name: Run C++ Tests
command: |
source ${INIT_ENV}
catkin_make run_tests
bash make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
# Run SonarCloud analysis
# PR Branchs and number extracted from Circle variables and github api
# Circle CI seems to make a change to the base branch, so we must fetch --force to ensure correct git file change stats
Expand All @@ -78,6 +78,12 @@ jobs:
name: Run Sonar Scanner
command: |
source ${INIT_ENV}
if [ -z "${CIRCLE_PULL_REQUEST}" ]; then
echo "Non-PR Build Detected. Running analysis on ${CIRCLE_BRANCH}"
cd src/CARMAAvtVimbaDriver
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN}
exit 0;
fi
echo "PR branch ${CIRCLE_BRANCH}"
echo "Repo name ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
echo "URL ${CIRCLE_PULL_REQUEST}"
Expand Down
4 changes: 2 additions & 2 deletions .sonarqube/sonar-scanner.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ sonar.organization=usdot-fhwa-stol
sonar.cfamily.build-wrapper-output=/opt/carma/bw-output
sonar.host.url=https://sonarcloud.io
sonar.sources=src/
# TODO Uncomment following line when tests are added
#sonar.tests=test/
sonar.cfamily.gcov.reportsPath=/opt/carma/coverage_reports/gcov
sonar.tests=test/
# Set Git as SCM sensor
sonar.scm.disabled=false
sonar.scm.enabled=true
Expand Down

0 comments on commit a8b902b

Please sign in to comment.