File tree Expand file tree Collapse file tree 3 files changed +89
-0
lines changed
Expand file tree Collapse file tree 3 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 1+ name : SonarCloud
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+ branches : [main]
8+
9+ jobs :
10+ build :
11+ name : Compile and Test
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v2
16+
17+ - name : Setup go
18+ uses : actions/setup-go@v2
19+ with :
20+ go-version : ^1.17
21+
22+ - name : Creating bin folder
23+ run : |
24+ mkdir -p bin
25+
26+ - name : Build app binary from src/*.go
27+ run : |
28+ go build -o bin/service-sonar src/*.go
29+
30+ - name : Running test
31+ run : |
32+ go test -short -coverprofile=bin/cov.out `go list ./... | grep -v vendor/`
33+
34+ - name : Running go toll cover
35+ run : |
36+ go tool cover -func=bin/cov.out
37+
38+ - name : Archive code coverage results
39+ uses : actions/upload-artifact@v1
40+ with :
41+ name : code-coverage-report
42+ path : bin
43+
44+ sonarCloudTrigger :
45+ needs : build
46+ name : SonarCloud Trigger
47+ runs-on : ubuntu-latest
48+ steps :
49+ - name : Checkout
50+ uses : actions/checkout@v2
51+
52+ - name : Download code coverage results
53+ uses : actions/download-artifact@v1
54+ with :
55+ name : code-coverage-report
56+ path : bin
57+
58+ - name : Analyze with SonarCloud
59+ uses : sonarsource/sonarcloud-github-action@master
60+ env :
61+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
Original file line number Diff line number Diff line change 11# TibiaData API in Golang
22
33[ ![ GitHub CI] ( https://github.com/TibiaData/tibiadata-api-go/workflows/build/badge.svg?branch=main )] ( https://github.com/TibiaData/tibiadata-api-go/actions?query=workflow%3Abuild )
4+ [ ![ Coverage] ( https://sonarcloud.io/api/project_badges/measure?project=TibiaData_tibiadata-api-go&metric=coverage )] ( https://sonarcloud.io/summary/new_code?id=TibiaData_tibiadata-api-go )
45[ ![ GitHub go.mod version] ( https://img.shields.io/github/go-mod/go-version/tibiadata/tibiadata-api-go )] ( https://github.com/tibiadata/tibiadata-api-go/blob/main/go.mod )
56[ ![ Docker version] ( https://img.shields.io/docker/v/tibiadata/tibiadata-api-go/latest )] ( https://hub.docker.com/r/tibiadata/tibiadata-api-go )
67[ ![ Docker size] ( https://img.shields.io/docker/image-size/tibiadata/tibiadata-api-go/latest )] ( https://hub.docker.com/r/tibiadata/tibiadata-api-go )
Original file line number Diff line number Diff line change 1+ sonar.projectKey =TibiaData_tibiadata-api-go
2+ sonar.organization =tibiadata
3+
4+ # This is the name and version displayed in the SonarCloud UI.
5+ # sonar.projectName=tibiadata-api-go
6+ # sonar.projectVersion=1.0
7+
8+ # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9+ sonar.sources =.
10+ sonar.exclusions =**/src/*_test.go,**/testdata/*
11+
12+ sonar.tests =.
13+ sonar.test.inclusions =**/src/*_test.go
14+ # sonar.test.exclusions=
15+ sonar.go.coverage.reportPaths =/github/workspace/bin/cov.out
16+
17+ # Encoding of the source code. Default is default system encoding
18+ sonar.sourceEncoding =UTF-8
19+
20+ # =====================================================
21+ # Properties specific to Go
22+ # =====================================================
23+
24+ # sonar.go.gometalinter.reportPaths=gometalinter-report.out
25+ # sonar.go.tests.reportPaths=report.json
26+ # sonar.go.coverage.reportPaths=coverage.out
You can’t perform that action at this time.
0 commit comments