Skip to content

Commit

Permalink
Add SonarQube config (#1105)
Browse files Browse the repository at this point in the history
* Add SonarQube config
  • Loading branch information
vcastellm authored Jan 16, 2023
1 parent af4b991 commit 2d0a036
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ jobs:
name: Test
uses: ./.github/workflows/test.yml
needs: build
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Test
on: # yamllint disable-line rule:truthy
workflow_dispatch:
workflow_call:
secrets:
SONAR_TOKEN:
required: true
SONAR_HOST_URL:
required: true

jobs:
go_test:
Expand All @@ -26,3 +31,20 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: coverage.out

# Triggering SonarQube analysis as results of it are required by Quality Gate check.
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Check the Quality Gate status.
- name: SonarQube Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
# Force to fail step after specific time.
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
20 changes: 20 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sonar.projectKey=polygon-edge

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

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

sonar.coverage.exclusions=**/vendor/**,**/*.py

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

#sonar.go.gometalinter.reportPaths=gometalinter-report.out
#sonar.go.govet.reportPaths=govet-report.out
#sonar.go.golint.reportPaths=golint-report.out
#sonar.go.tests.reportPaths=report.json
sonar.go.coverage.reportPaths=coverage.out

0 comments on commit 2d0a036

Please sign in to comment.