Skip to content
Open
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
hooks:
- id: make-check
name: make check
description: Run project checks, gofmt, golangci-lint, tests and coverage
description: Run project checks, gofmt, golangci-lint, tests
entry: make check
language: system
pass_filenames: false
Expand Down
20 changes: 3 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ GREEN := $(shell printf "\033[32m")
RED := $(shell printf "\033[31m")
RESET := $(shell printf "\033[0m")

COVERAGE_REQUIRED := 55
MOCKGEN_VERSION := 0.5.2
LINTER_VERSION := 2.1.6

Expand All @@ -27,11 +26,8 @@ modtidy:
.PHONY: test
test:
## We have several race condition warnings (as expected), but those will be fixed on the next PRs
## GO_ENABLED=1 go test -race -count=1 -vet all -coverprofile=cover.out.tmp ./...
go test -count=1 -vet all -coverprofile=cover.out.tmp ./...
grep -v -e "_mock\.go:" -e "/mocks/" -e "/docs/" cover.out.tmp > cover.out
go tool cover -func=cover.out
rm cover.out.tmp
## CGO_ENABLED=1 go test -race -count=1 -vet all -coverprofile=cover.out ./...
go test -count=1 -vet all -coverprofile=cover.out ./...

save: build
docker save $(image_name) > $(image_file_name)
Expand All @@ -45,17 +41,7 @@ build-local:
generate: check-mockgen-version
go generate ./...

check: lint test coverage-check

.PHONY: coverage-check
coverage-check: test
@coverage=$$(go tool cover -func=cover.out | grep '^total:' | awk '{print $$3}' | sed 's/%//g'); \
if awk "BEGIN {exit !($$coverage < $(COVERAGE_REQUIRED))}"; then \
echo "error: coverage ($$coverage%) must be at least $(COVERAGE_REQUIRED)%"; \
exit 1; \
else \
echo "test coverage: $$coverage% (threshold: $(COVERAGE_REQUIRED)%)"; \
fi
check: lint test

.PHONY: test-coverage
test-coverage: test coverage-check
Expand Down
33 changes: 33 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
coverage:
ignore:
# Exclude main.go since we mostly use it for Dependency Injection
- "main.go"
- "cmd/main.go"

# Test files - these shouldn't be included in coverage
- "**/*_test.go"

# Mock files - generated code for testing
- "**/*_mock.go"
- "**/mocks"

# Vendor directory - third-party dependencies
- "**/vendor/**"

# Documentation and examples
- "**/docs"
- "**/examples/**"

# Build and CI related files
- "**/.ci/**"
- "**/tools.go" # Build tools imports

# Test utilities and fixtures
- "**/testdata/**"
- "**/fixtures/**"
- "**/tests/**" # If this contains test utilities rather than actual tests

status:
project:
default:
target: 70%
Loading