Skip to content

Commit

Permalink
make: add task to generate coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
dmke committed Feb 16, 2022
1 parent 513f699 commit de8d9df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
example/daemon/daemon
coverage.out
coverage.tmp
coverage.html
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ format: ## Formats all Go code
lint: ## Runs golangci-lint on source files
golangci-lint run

.PHONY: coverage.out
coverage.out: $(wildcard go.*) $(wildcard **/*.go)
go test -race -covermode=atomic -coverprofile=$@ ./...

coverage.html: coverage.out
go tool cover -html $< -o $@

.PHONY: test
test: ## Run all Go tests (excluding integration tests)
go test -race -covermode=atomic -coverprofile=coverage.out ./...
test: coverage.out ## Run all Go tests (excluding integration tests)

.PHONY: integration
integration: ## Run Go tests (integration tests only)
go test -race -tags=integration -covermode=atomic -coverprofile=coverage.out ./...

.PHONY: clean
clean:
rm -rf coverage.*

0 comments on commit de8d9df

Please sign in to comment.