Skip to content

Commit

Permalink
Configure SonarCloud (#1944)
Browse files Browse the repository at this point in the history
  • Loading branch information
hariso authored Nov 6, 2024
1 parent 1529b12 commit 7028b67
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Test
run: make test-integration GOTEST_FLAGS="-v -count=1"
# The test coverate and the test report are needed for the SonarCloud analysis
run: make test-integration GOTEST_FLAGS="-v -count=1 -coverprofile coverage.out" 2>&1 | tee test-report.out

- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
run:
timeout: 3m

output:
formats:
- format: colored-line-number
path: stdout
# Needed for the SonarCloud analysis
- format: checkstyle
path: golangci-report.xml

linters-settings:
depguard:
rules:
Expand Down
31 changes: 31 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

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

sonar.projectKey=conduit
sonar.organization=conduitio
sonar.projectName=Conduit

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

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

# =====================================================
# Metadata for the project
# =====================================================

sonar.links.homepage=https://conduit.io/
sonar.links.scm=https://github.com/ConduitIO/conduit
sonar.links.issue=https://github.com/ConduitIO/conduit/issues

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

sonar.go.gometalinter.reportPaths=golangci-report.xml
sonar.go.tests.reportPaths=test-report.out
sonar.go.coverage.reportPaths=coverage.out

0 comments on commit 7028b67

Please sign in to comment.