Skip to content

Commit

Permalink
ci: send test coverage to Sonar Cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatanabe committed Nov 20, 2023
1 parent fe2d72a commit 425ca17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-go@v4
with:
go-version: '^1.21' # The Go version to download (if necessary) and use.
- name: Build
run: go build -v ./...
- name: Test
run: go test -race -json -covermode=atomic -coverprofile=cover.out -p=10 ./... > result.json
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ sonar.test.inclusions=**/*_test.go

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

sonar.go.coverage.reportPaths=cover.out
sonar.go.tests.reportPaths=result.json

0 comments on commit 425ca17

Please sign in to comment.