-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (42 loc) · 1.58 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.PHONY: release unit-test integration-test acceptance-test test coverage clean
help:
@echo "release .......................... Build issuez CLI supported OSs"
@echo "test-unit ........................ Run unit tests"
@echo "test-integration ................. Run integration tests"
@echo "test-acceptance .................. Run acceptance tests"
@echo "test ............................. Run all tests"
@echo "coverage ......................... Measure code coverage"
@echo "clean ............................ Clean build artifacts"
GO_FILES=$(shell find . -path '*.go' -not -name '*_test.go')
release: ./dist/issuez-linux ./dist/issuez-darwin
./dist/issuez-linux: ${GO_FILES}
GOOS=linux go build -o ./dist/issuez-linux .
./dist/issuez-darwin: ${GO_FILES}
GOOS=darwin go build -o ./dist/issuez-darwin .
# Testing
GO_UNIT_TESTS=$(shell go list ./... | grep -v acceptance | grep -v integration)
test-unit:
./hack/test.sh ${GO_UNIT_TESTS}
test-integration:
./hack/test.sh ./integration
test-acceptance:
./hack/test.sh ./acceptance
test:
@echo '== UNIT TESTS =================='
./hack/test.sh ${GO_UNIT_TESTS}
@echo
@echo '== INTEGRATION TESTS ==========='
./hack/test.sh ./integration
@echo
@echo '== ACCEPTANCE TESTS ============'
./hack/test.sh ./acceptance
coverage: clean
@echo '== TESTS ========================'
HACK_TEST_EXTRA_ARGS="-test.coverprofile cp.out" ./hack/test.sh ${GO_UNIT_TESTS}
@echo
@echo '== COVERAGE ANALYSIS ==========='
go tool cover -html=cp.out -o=./coverage.html
# Housekeeping
clean:
rm -rf ./dist ./cp.out ./coverage.html
go clean -testcache