diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 0d1b90b..9959956 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -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() diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index 3ee4c2c..7c0045d 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -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: @@ -47,10 +47,7 @@ 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() @@ -58,25 +55,22 @@ jobs: 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 }} diff --git a/sonar-project.properties b/sonar-project.properties index ff2b9d5..419dc48 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -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=.