-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
37 lines (28 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
TEST_COVERAGE_OUTPUT_ROOT := $(CURDIR)/.coverage/unit
FUNCTIONAL_COVERAGE_OUTPUT_ROOT := $(CURDIR)/.coverage/functional
COVERAGE_PROFILE := $(CURDIR)/.coverage/profile
COVERAGE_REPORT := $(CURDIR)/.coverage/report.html
test: unit-test functional-test
unit-test:
go test ./app/{billing,order,shipment}
functional-test:
go test ./app/test
$(TEST_COVERAGE_OUTPUT_ROOT):
mkdir -p $(TEST_COVERAGE_OUTPUT_ROOT)
$(FUNCTIONAL_COVERAGE_OUTPUT_ROOT):
mkdir -p $(FUNCTIONAL_COVERAGE_OUTPUT_ROOT)
$(SUMMARY_COVERAGE_OUTPUT_ROOT):
mkdir -p $(SUMMARY_COVERAGE_OUTPUT_ROOT)
unit-test-coverage: $(TEST_COVERAGE_OUTPUT_ROOT)
@echo Unit test coverage
go test -cover ./app/billing -args -test.gocoverdir=$(TEST_COVERAGE_OUTPUT_ROOT)
go test -cover ./app/order -args -test.gocoverdir=$(TEST_COVERAGE_OUTPUT_ROOT)
go test -cover ./app/shipment -args -test.gocoverdir=$(TEST_COVERAGE_OUTPUT_ROOT)
functional-test-coverage: $(FUNCTIONAL_COVERAGE_OUTPUT_ROOT)
@echo Functional test coverage
go test -cover ./app/test -coverpkg ./... -args -test.gocoverdir=$(FUNCTIONAL_COVERAGE_OUTPUT_ROOT)
coverage-report: $(TEST_COVERAGE_OUTPUT_ROOT) $(FUNCTIONAL_COVERAGE_OUTPUT_ROOT) $(SUMMARY_COVERAGE_OUTPUT_ROOT)
@echo Summary coverage report
go tool covdata textfmt -i $(TEST_COVERAGE_OUTPUT_ROOT),$(FUNCTIONAL_COVERAGE_OUTPUT_ROOT) -o $(COVERAGE_PROFILE)
go tool covdata percent -i $(TEST_COVERAGE_OUTPUT_ROOT),$(FUNCTIONAL_COVERAGE_OUTPUT_ROOT)
go tool cover -html=$(COVERAGE_PROFILE) -o $(COVERAGE_REPORT)