Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile.util.mk - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 626d146b41c0cd5bff7e54cfc8e25e53d9deb0e2 (plain)
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
.PHONY: verify fmt vet lint complexity test cover list

verify: list fmt vet lint complexity

fmt: bin/goimports .GOPATH/.ok
	$Q @./bin/goimports -local $(IMPORT_PATH) -l $(allfiles) | awk '{ print } END { if (NR>0) { print "Please run ./bin/goimports -w -local $(IMPORT_PATH) -l $(allfiles)"; exit 1 } }'

vet: .GOPATH/.ok
	$Q go vet $(allpackages)

lint: bin/golint
	$Q ./bin/golint $(allpackages) | tee | ( ! grep -v "^$$" )

complexity: .GOPATH/.ok bin/gocyclo
	$Q ./bin/gocyclo -over 9 $(allfiles)

test: .GOPATH/.ok gitlab-pages
	go test $(if $V,-v) $(allpackages)

acceptance: .GOPATH/.ok gitlab-pages
	go test $(if $V,-v) $(IMPORT_PATH)

bench: .GOPATH/.ok gitlab-pages
	go test -bench=. -run=^$$ $(allpackages)

# The acceptance tests cannot count for coverage
cover: bin/gocovmerge .GOPATH/.ok
	@echo "NOTE: make cover does not exit 1 on failure, don't use it to check for tests success!"
	$Q rm -f .GOPATH/cover/*.out .GOPATH/cover/all.merged
	$(if $V,@echo "-- go test -coverpkg=./... -coverprofile=.GOPATH/cover/... ./...")
	@for MOD in $(allpackages); do \
		go test \
			-short \
			-coverpkg=`echo $(allpackages)|tr " " ","` \
			-coverprofile=.GOPATH/cover/unit-`echo $$MOD|tr "/" "_"`.out \
			$$MOD 2>&1 | grep -v "no packages being tested depend on"; \
	done
	$Q ./bin/gocovmerge .GOPATH/cover/*.out > .GOPATH/cover/all.merged
	$Q go tool cover -html .GOPATH/cover/all.merged -o coverage.html
	@echo ""
	@echo "=====> Total test coverage: <====="
	@echo ""
	$Q go tool cover -func .GOPATH/cover/all.merged

list: .GOPATH/.ok
	@echo $(allpackages)