Skip to content

Commit

Permalink
Merge pull request #31 from virtru/feature/sonar
Browse files Browse the repository at this point in the history
SonarCloud
  • Loading branch information
pflynn-virtru committed Nov 16, 2023
2 parents f1e9121 + 455c354 commit 5f932c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Quality Gate
name: Quality Gate and SonarCloud analysis
env:
COVERAGE_THRESH_PCT: 81

Expand All @@ -22,6 +22,11 @@ jobs:
run: go install github.com/klmitch/overcover@v1.2.1
- name: Run unit test with coverage
run: go test --coverprofile cover.out ./pdp ./attributes ./protoconv
- name: SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Check coverage meets threshold
run: overcover --coverprofile cover.out ./pdp ./attributes --threshold ${{ env.COVERAGE_THRESH_PCT }}
- uses: actions/setup-python@v4
Expand Down
15 changes: 15 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# must be unique in a given SonarQube instance
sonar.projectKey=virtru_access-pdp
sonar.organization=virtru

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=attributes,pdp,protoconv
sonar.exclusions=**/*_test.go,**/mock_*.go

sonar.test.inclusions=**/*_test.go

sonar.go.coverage.reportPaths=cover.out

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

0 comments on commit 5f932c3

Please sign in to comment.