-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (33 loc) · 1.33 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
.PHONY: format lint tidy test clean
# -----------------------------------------------------------------------------
# CONSTANTS
# -----------------------------------------------------------------------------
version = `cat VERSION`
src_dir = redash
build_dir = build
coverage_dir = $(build_dir)/coverage
coverage_out = $(coverage_dir)/coverage.out
coverage_html = $(coverage_dir)/coverage.html
# -----------------------------------------------------------------------------
# FORMATTING
# -----------------------------------------------------------------------------
format:
GO111MODULE=on go fmt ./$(src_dir)
GO111MODULE=on gofmt -s -w ./$(src_dir)
lint:
GO111MODULE=on go get -u golang.org/x/lint/golint
GO111MODULE=on golint ./$(src_dir)
tidy:
GO111MODULE=on go mod tidy
# -----------------------------------------------------------------------------
# TESTING
# -----------------------------------------------------------------------------
test:
mkdir -p $(coverage_dir)
GO111MODULE=on go test ./$(src_dir) -tags test -v -covermode=count -coverprofile=$(coverage_out)
GO111MODULE=on go tool cover -html=$(coverage_out) -o $(coverage_html)
# -----------------------------------------------------------------------------
# CLEANUP
# -----------------------------------------------------------------------------
clean:
rm -rf $(build_dir)