-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (69 loc) · 2.21 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
BUILD=build
.PHONY: release
release:
@echo "Release v$(version)"
@git pull
@git checkout master
@git pull
@git checkout develop
@git flow release start $(version)
@git flow release finish $(version) -p -m "Release v$(version)"
@git checkout develop
@echo "Release v$(version) finished."
.PHONY: all
all: coverage.out
coverage.out: $(shell find . -type f -print | grep -v vendor | grep "\.go")
@go test -race -cover -covermode=atomic -coverprofile ./coverage.out.tmp ./...
@cat ./coverage.out.tmp | grep -v '.pb.go' | grep -v 'mock_' > ./coverage.out
@rm ./coverage.out.tmp
.PHONY: test
test: coverage.out
.PHONY: cover
cover: coverage.out
@echo ""
@go tool cover -func ./coverage.out
.PHONY: cover-html
cover-html: coverage.out
@go tool cover -html=./coverage.out
.PHONY: benchmark
benchmark:
@go test -bench=. ./...
.PHONY: clean
clean:
@rm ./coverage.out
@go clean -i ./...
.PHONY: generate
generate:
@CGO_ENABLED=0 go generate ./...
.PHONY: lint
lint:
@CGO_ENABLED=0 golangci-lint run ./...
${BUILD}/plugin/%.so: plugin/%/*.go
@echo "Building $* plugin..."
@go build -buildmode=plugin -o $@ ./plugin/$*
plugins: ${BUILD}/plugin/healthcheck.so
.PHONY: docs
docs: docs/units.md
docs/units.md: resources/unit-categories.json
@echo "Generate $@..."
@go run cmd/generate-docs/main.go -- $@
pkg/hyperdash/config/enum.go: resources/unit-categories.json
@echo "Generate $@..."
@go run cmd/generate-enum/main.go -- $@
www/scripts/dist/index.js: www/scripts/src/index.ts www/scripts/src/* www/scripts/package.json www/scripts/package-lock.json
@echo "Generate js..."
@cd ./www/scripts/; \
./node_modules/.bin/webpack
pkg/hyperdash/ui/scripts/app.js: www/scripts/dist/index.js
@cp $< $@
${BUILD}/hyperdash: $(shell find . -type f -print | grep -v vendor | grep "\.go") pkg/hyperdash/ui/scripts/app.js pkg/hyperdash/config/enum.go
@echo "Building hyperdash..."
@go generate ./cmd/hyperdash/
@go build -o $@ ./cmd/hyperdash/
build: ${BUILD}/hyperdash plugins
run: ${BUILD}/hyperdash
@$< run demo/angell.hcl
docker-build: $(shell find . -type f -print | grep -v vendor | grep "\.go") pkg/hyperdash/config/enum.go
@echo "Building hyperdash..."
@go generate ./cmd/hyperdash/
@go build -o hyperdash ./cmd/hyperdash/