Skip to content

Commit 425ca17

Browse files
committed
ci: send test coverage to Sonar Cloud
1 parent fe2d72a commit 425ca17

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened]
88
jobs:
9-
sonarcloud:
10-
name: SonarCloud
9+
build:
10+
name: Build
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
- uses: actions/setup-go@v4
17+
with:
18+
go-version: '^1.21' # The Go version to download (if necessary) and use.
19+
- name: Build
20+
run: go build -v ./...
21+
- name: Test
22+
run: go test -race -json -covermode=atomic -coverprofile=cover.out -p=10 ./... > result.json
1623
- name: SonarCloud Scan
1724
uses: SonarSource/sonarcloud-github-action@master
1825
env:

sonar-project.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ sonar.test.inclusions=**/*_test.go
1414

1515
# Encoding of the source code. Default is default system encoding
1616
sonar.sourceEncoding=UTF-8
17+
18+
sonar.go.coverage.reportPaths=cover.out
19+
sonar.go.tests.reportPaths=result.json

0 commit comments

Comments
 (0)