-
Notifications
You must be signed in to change notification settings - Fork 0
tests: add checks, coverage to pipeline #12
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,5 +26,5 @@ go.work.sum | |
|
|
||
| .idea | ||
| duckdb | ||
| duckdb.exe | ||
| getaduck | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| .PHONY: test | ||
| test: | ||
| mkdir -p coverage/covdata | ||
| # Use the new binary format to ensure integration tests and cross-package calls are counted towards coverage | ||
| # https://go.dev/blog/integration-test-coverage | ||
| # -p 1 disable parallel testing in favor of streaming log output - https://github.com/golang/go/issues/24929#issuecomment-384484654 | ||
| go test -race -cover -covermode atomic -v -vet=all -timeout 15m -p 1\ | ||
| ./... \ | ||
| -args -test.gocoverdir="${PWD}/coverage/covdata" \ | ||
| | ts -s | ||
| # NB: ts command requires moreutils package; awk trick from https://stackoverflow.com/a/25764579 doesn't stream output | ||
| go tool covdata percent -i=./coverage/covdata | ||
| # Convert to old text format for coveralls upload | ||
| go tool covdata textfmt -i=./coverage/covdata -o ./coverage/covprofile | ||
| go tool cover -html=./coverage/covprofile -o ./coverage/coverage.html | ||
|
|
||
| .PHONY: short-test | ||
| short-test: | ||
| go test -v -short ./... | ||
|
|
||
| #NB: CI uses the golangci-lint Github action, not this target | ||
| .PHONY: lint | ||
| lint: | ||
| go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.5 run -v | ||
murfffi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| .PHONY: checks | ||
| checks: check_tidy check_vuln check_modern | ||
|
|
||
| .PHONY: check_vuln | ||
| check_vuln: | ||
| go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./... | ||
| # if we use more tools, we can switch to go tool -modfile=tools.mod | ||
| # there is good discussion at https://news.ycombinator.com/item?id=42845323 | ||
|
|
||
| check_tidy: | ||
| go mod tidy | ||
| # Verify that `go mod tidy` didn't introduce any changes. Run go mod tidy before pushing. | ||
| git diff --exit-code --stat go.mod go.sum | ||
|
|
||
| .PHONY: check_modern | ||
| check_modern: | ||
| go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.20.0 ./... | ||
murfffi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # non-zero exit status on issues found | ||
| # nb: modernize is not part of golangci-lint yet - https://github.com/golangci/golangci-lint/issues/686 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.