Skip to content

Commit

Permalink
Merge pull request #59 from xmidt-org/add-sonar
Browse files Browse the repository at this point in the history
Fix the makefile target name.
  • Loading branch information
schmidtw authored Aug 27, 2020
2 parents 577b9c3 + 4afc579 commit ad26df1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pkg/
lib/
*.out
*.swp
coverage.txt
report.json

# for VSCode
.vscode/
Expand Down
33 changes: 33 additions & 0 deletions .sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Reference:
# https://github.com/SonarSource/sonarcloud_example_go-sqscanner-travis/blob/master/sonar-project.properties


# =====================================================
# Standard properties
# =====================================================

sonar.projectKey=xmidt-org_themis
sonar.projectName=themis

sonar.sources=.
sonar.exclusions=**/*_test.go,**/vendor/**

sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**

# =====================================================
# Meta-data for the project
# =====================================================

sonar.links.homepage=https://github.com/xmidt-org/themis
sonar.links.ci=https://travis-ci.org/xmidt-org/themis
sonar.links.scm=https://github.com/xmidt-org/themis
sonar.links.issue=https://github.com/xmidt-org/themis/issues

# =====================================================
# Properties specific to Go
# =====================================================

sonar.go.tests.reportPaths=report.json
sonar.go.coverage.reportPaths=coverage.txt
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ branches:
- main
- /^v[0-9]+\.[0-9]+\.[0-9]+$/

addons:
sonarcloud:
organization: "xmidt-org"
token:
secure: "ntDM9wWDwMDnPpm14b0MxqCrI88QHB+b4NhCzK5AXaO/mKRixD0ukQ/TUyqTn5dYA9U5knD4k3/YrlBHg31ywb8x+Wfg1nMMhj8tvHS3c7gvO7C148cVkudOnmWMGMQDmbXoWIhmWo4k2vKe+dQbTg+sDmDmufyM1Z+jko4Qpjbifws2mqTkmeqmteTHnht7aZorVVanSr3JC7mE9dhFChYTeV++hXvHhgIge1euodDpmOKfbpfnOQtM4z2g6PT2IPAQY1kskFqUc/CJ6CIG0YDfEbBMeL8Tf8dPL4IvVMtm9+G2REpi0sOwk1H0zRkUC3ONDUmFEJ2uRykQwNZzD2aCvay2yRht9OS+GQXHg98f9caCTi1jHieBadnHw99Ylj5bnP68wbEKME6k4NRfBvUJrbKsYMx8lS50YEs6zwgspRv8jRPohlKtKDu2k98r+1EwDtP+U6HG0tRiGev+hYPUR0mlYM93igygHT3xfnMqgW8dIpxT3NzPmffolDuZtw82SEr4HCJGsW4bOZW1A53mybdF9HPI64XlK8qN7xVdDF1SMuz+RrOPOvsmApQeBHkV5mMzLRkxC0EhfeOl5QDYi3fD0nfNCqclhOYk9R05k2trIL2htyhsqqi17OZmzN28o2WGlDXzPT7aHwg21I6egypIoSgOi8jEEf6XpcI="


script:
- make style codecov

after_success:
- sonar-scanner -Dproject.settings=./.sonar-project.properties

jobs:
fast_finish: true
allow_failures:
Expand All @@ -41,6 +51,8 @@ jobs:
- export TODAY=`date +'%m/%d/%Y'`
- export NOTES=$(cat CHANGELOG.md | perl -0777 -ne 'print "$ENV{TODAY}\n\n$1\n" if /.*## \[$ENV{TAG}\]\s(.*?)\s+## \[(v\d+.\d+.\d+)\].*/s')
- if [[ "$TAG" != "" && "$TAG" != "$OLD_VERSION" ]]; then git tag -a "$TAG" -m "$NOTES"; git push origin --tags; echo $?; fi
after_success: skip

- stage: release
name: "Make a Release"
if: branch != main
Expand All @@ -65,4 +77,4 @@ jobs:
script: bash deploy/docker_push
on:
all_branches: true
tags: true
tags: true
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ style:

.PHONY: test
test: vendor
GO111MODULE=on $(GO) test -v -race -coverprofile=cover.out ./...
GO111MODULE=on $(GO) test -v -race -coverprofile=coverage.txt ./...
GO111MODULE=on $(GO) test -v -race -json ./... > report.json

.PHONY: test-cover
test-cover: test
$(GO) tool cover -html=cover.out
$(GO) tool cover -html=coverage.txt

.PHONY: codecov
codecov: test
Expand All @@ -87,4 +88,4 @@ it:

.PHONY: clean
clean:
rm -rf ./$(APP) ./.ignore ./coverage.txt ./vendor
rm -rf ./$(APP) ./.ignore ./coverage.txt ./vendor report.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/xmidt-org/themis)](https://goreportcard.com/report/github.com/xmidt-org/themis)
[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/xmidt-org/themis/blob/main/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/xmidt-org/themis?include_prereleases)](CHANGELOG.md)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xmidt-org_themis&metric=alert_status)](https://sonarcloud.io/dashboard?id=xmidt-org_themis)

## Summary

Expand Down

0 comments on commit ad26df1

Please sign in to comment.