Skip to content
Merged
Changes from 1 commit
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
Next Next commit
add explore-test-coverage make target
  • Loading branch information
cjerad committed May 26, 2022
commit d4be60597c09398c43ecec0ecc98cd6b99798b8f
12 changes: 11 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# The "grouped targets" feature requires Make 4.3.
ifneq (4.3,$(firstword $(sort $(or $(MAKE_VERSION),00-unknown) 4.3)))
$(error using make version $(MAKE_VERSION), please use version 4.3 or newer)
endif

PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen
KO = $(PROJECT_DIR)/bin/ko
Expand All @@ -15,6 +20,7 @@ KODATA = \
cmd/controller/kodata/refs \
cmd/webhook/kodata/HEAD \
cmd/webhook/kodata/refs
CODECOVERAGE_OUT = $(PROJECT_DIR)/coverprofile.out

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down Expand Up @@ -66,10 +72,14 @@ verify: ## Run go fmt and go vet against code.
go vet $(PROJECT_DIR)/...

.PHONY: test
test: $(GINKGO) ## Run tests.
test $(CODECOVERAGE_OUT) &: $(GINKGO) ## Run tests.
go vet $(PROJECT_DIR)/...
$(GINKGO) run $(GINKGO_BASE_OPTS) $(GINKGO_OPTS) $(PROJECT_DIR)/test/

.PHONY: explore-test-coverage
explore-test-coverage: $(CODECOVERAGE_OUT) ## Display test coverage report in default web browser.
go tool cover -html=$<

##@ Build

.PHONY: run
Expand Down