Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sonar: add test coverage #9988

Merged
merged 7 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ jobs:
- name: Test
run: make test

- name: SonarCloud
if: runner.os == 'Linux'
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true

tests-windows:
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
strategy:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ go.work*
docker-compose.*.yml
.env
coverage.out
coverage-erigon.out
coverage-erigon-lib.out

dist
__debug_bin
Expand All @@ -99,4 +101,4 @@ node_modules
/config.yaml
/config.yml

vendor
vendor
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test-erigon-ext:

## test: run unit tests with a 100s timeout
test: test-erigon-lib
$(GOTEST) --timeout 10m
$(GOTEST) --timeout 10m -coverprofile=coverage-erigon.out

test3: test-erigon-lib
$(GOTEST) --timeout 10m -tags $(BUILD_TAGS),e3
Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ lint-deps: lintci-deps lint-licenses-deps
lint: lintci lint-licenses lint-mod-tidy

test:
$(GOTEST) --count 1 -p 2 ./...
$(GOTEST) --count 1 -p 2 -coverprofile=coverage-erigon-lib.out ./...

test-no-fuzz:
$(GOTEST_NOFUZZ) --count 1 -p 2 ./...
11 changes: 11 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sonar.projectKey=ledgerwatch_erigon
sonar.organization=ledgerwatch
sonar.projectName=erigon

sonar.sources=.
sonar.exclusions=**/*.pb.go,cmd/rpcdaemon/graphql/graph/generated.go,erigon-lib/pedersen_hash/**

sonar.tests=.
sonar.test.inclusions=**/*_test.go,tests/**

sonar.go.coverage.reportPaths=coverage-erigon.out,coverage-erigon-lib.out
Loading