File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed
Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ name : sonarcloud-analysis
2+ on :
3+ pull_request :
4+ branches :
5+ - " master"
6+ push :
7+ branches :
8+ - " master"
9+
10+ permissions :
11+ contents : read
12+ pull-requests : read
13+
14+ env :
15+ GO_VERSION : ' 1.22' # Use the version you need
16+ GOLANGCI_LINT_VERSION : v1.59 # Latest version as of my last update
17+
18+ jobs :
19+ sonarcloud :
20+ name : SonarCloud
21+ runs-on : ubuntu-latest
22+ steps :
23+ - name : Checkout
24+ uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
27+
28+ - uses : actions/setup-go@v5
29+ with :
30+ go-version : ${{ env.GO_VERSION }}
31+
32+ - name : Install test reporter
33+ run : go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest
34+
35+ - name : Run Go tests
36+ run : go test -json -coverprofile=coverage.out ./... | go-ctrf-json-reporter -output ctrf-report.json
37+ continue-on-error : true
38+
39+ - name : Publish Test Summary Results
40+ run : npx github-actions-ctrf ctrf-report.json
41+
42+ # Re-run golangci separately without exiting on errors and generating a report for use in Sonar
43+ - name : golangci-lint
44+ uses : golangci/golangci-lint-action@v6
45+ with :
46+ version : ${{ env.GOLANGCI_LINT_VERSION }}
47+ args : --timeout=5m --issues-exit-code=0 --out-format=checkstyle:golangci-lint-report.xml
48+
49+ - name : SonarCloud Scan
50+ uses : SonarSource/sonarcloud-github-action@master
51+ env :
52+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
Original file line number Diff line number Diff line change @@ -33,4 +33,8 @@ Thumbs.db
3333.env.test
3434.env.production
3535
36+ # SonarCloud temporary files
37+ coverage.out
38+ golangci-lint-report.xml
39+
3640# Ignore any other files or directories specific to your project
Original file line number Diff line number Diff line change 1+ sonar.projectKey =bitcoin-sv_go-sdk
2+ sonar.organization =bitcoin-sv
3+ sonar.projectName =Go SDK
4+ sonar.projectDescription =BSV BLOCKCHAIN | Software Development Kit for Go
5+ sonar.projectVersion =1.0.0
6+ sonar.sources =.
7+ sonar.sourceEncoding =UTF-8
8+ sonar.go.coverage.reportPaths =coverage.out
9+ sonar.go.golangci-lint.reportPaths =golangci-lint-report.xml
10+
11+ sonar.exclusions =**test**,**/docs/**,**vendor**
12+ sonar.coverage.exclusions =docs/**
13+ sonar.tests =.
14+ sonar.test.inclusions =**/*_test.go
15+ sonar.python.version =3.12
You can’t perform that action at this time.
0 commit comments