Skip to content

Commit

Permalink
Merge pull request #56 from smartcontractkit/update-sonar
Browse files Browse the repository at this point in the history
Update Sonar properties and bump action
  • Loading branch information
patrickhuie19 authored Feb 15, 2024
2 parents db2d761 + c1a9eca commit 04e147a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
${{ runner.os }}-go
- name: Run Test Suite
run: set -o pipefail && go test ./... -coverpkg=./... -coverprofile=coverage.txt $1 | tee $OUTPUT_FILE
run: set -o pipefail && go test ./... -coverpkg=./... -coverprofile=coverage.txt

- name: Run Race Test Suite
run: set -o pipefail && go test -race ./... -coverpkg=./... -coverprofile=race_coverage.txt $1 | tee $OUTPUT_FILE
run: set -o pipefail && go test -race ./... -coverpkg=./... -coverprofile=race_coverage.txt

- name: Upload Go test results
if: always()
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
max-timeout: "900"
polling-interval: "30"
exclude-workflow-names: ""
exclude-workflow-names: "CD Release, Dependency Vulnerability Check"
exclude-workflow-ids: ""
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
Expand All @@ -47,36 +47,30 @@ jobs:
with:
workflow: ci-lint.yml
name: golangci-lint-report
workflow_conclusion: ""
name_is_regexp: true
if_no_artifact_found: warn
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Download go unit test coverage reports
if: always()
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: ci-test.yml
name: go-test-results
workflow_conclusion: ""
name_is_regexp: true
if_no_artifact_found: warn
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set SonarQube Report Paths
if: always()
id: sonarqube_report_paths
shell: bash
run: |
echo "sonarqube_coverage_report_paths=$(find -type f -name '*coverage.txt' -printf '%p,')" >> $GITHUB_OUTPUT
echo "sonarqube_go_coverage_report_paths=$(find -type f -name '*coverage.txt' -printf '%p,')" >> $GITHUB_OUTPUT
echo "sonarqube_golangci_report_paths=$(find -type f -name 'golangci-lint-report.xml' -printf '%p,')" >> $GITHUB_OUTPUT
- name: SonarQube Scan
if: always()
uses: sonarsource/sonarqube-scan-action@a6ba0aafc293e03de5437af7edbc97f7d3ebc91a # v1.2.0
uses: sonarsource/sonarqube-scan-action@v2.0.1
with:
args: >
-Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }}
-Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_go_coverage_report_paths }}
-Dsonar.go.golangci-lint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_golangci_report_paths }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
22 changes: 20 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# projectKey is required (may be found under "Project Information" in Sonar or in project url)
sonar.projectKey=smartcontractkit_wsrpc
sonar.sources=.
sonar.sourceEncoding=UTF-8

# Full exclusions from the static analysis
sonar.exclusions=**/protoc-gen-go-wsrpc/protoc-gen-go-wsrpc, **/mocks/**/*, **/testdata/**/*, **/script/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.pb.go, **/*report.xml, **/*.txt, **/*.abi, **/*.bin, **/*.yml
sonar.exclusions=\
**/mocks/**/*,\
**/testdata/**/*,\
**/script/**/*,\
**/generated/**/*,\
**/fixtures/**/*,\
**/docs/**/*,\
**/tools/**/*,\
**/cmd/protoc-gen-go-wsrpc/protoc-gen-go-wsrpc,\
**/*.pb.go,\
**/*report.xml,\
**/*.txt,\
**/*.abi,\
**/*.bin

# Coverage exclusions
sonar.coverage.exclusions=**/*_test.go, **/utils/**/*, **/examples/**/*, **/intgtest/**/*
sonar.coverage.exclusions=\
**/*_test.go,\
**/utils/**/*,\
**/examples/**/*

# Tests' root folder, inclusions (tests to check and count) and exclusions
sonar.tests=.
Expand Down

0 comments on commit 04e147a

Please sign in to comment.