Skip to content

Commit

Permalink
Makefile: implement a target to create coverage-report
Browse files Browse the repository at this point in the history
  • Loading branch information
schuellerf committed Aug 21, 2024
1 parent 53e48d4 commit f52300b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ container_composer_golangci_built.info
processed-templates

coverage.txt
coverage.html

coverage_splunk_logger.txt
coverage_splunk_logger.html
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ help:
@echo " (do this before pushing!)"
@echo " lint: Runs linters as close as github workflow as possible"
@echo " process-templates: Execute the OpenShift CLI to check the templates"
@echo " coverage-report: Run unit tests and generate HTML coverage reports"

$(BUILDDIR)/:
mkdir -p "$@"
Expand Down Expand Up @@ -241,6 +242,10 @@ unit-tests:
cd pkg/splunk_logger
go test -race -covermode=atomic -coverprofile=../../coverage_splunk_logger.txt -coverpkg=$$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./...

.PHONY: coverage-report
coverage-report: unit-tests
go tool cover -o coverage.html -html coverage.txt
go tool cover -o coverage_splunk_logger.html -html coverage_splunk_logger.txt

#
# Building packages
Expand Down

0 comments on commit f52300b

Please sign in to comment.