Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage to sonar cloud ci #7

Merged
merged 1 commit into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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