-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
54 lines (43 loc) · 1.15 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
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
OS=$(shell uname -s)
export GO111MODULE := on
setup:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
go mod download
.PHONY: setup
test:
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: test
cover: test
go tool cover -html=coverage.txt
.PHONY: cover
fmt:
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
jsonnet fmt -i ./grafana/*.jsonnet
.PHONY: fmt
lint:
./bin/golangci-lint run --enable-all ./...
promtool check rules prometheus/rules/couchbase.rules.yml
jsonnet fmt --test ./grafana/*.jsonnet
.PHONY: lint
ci: build test lint
.PHONY: ci
build: grafana
go build
.PHONY: build
todo:
@grep \
--exclude-dir=vendor \
--exclude-dir=bin \
--exclude-dir=grafana/grafonnet \
--exclude=Makefile \
--text \
--color \
-nRo -E ' TODO:.*|SkipNow' .
.PHONY: todo
grafana:
jsonnet -J grafana grafana/dashboard.jsonnet -o grafana/dashboard.json
.PHONY: grafana
.DEFAULT_GOAL := build