-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (49 loc) · 1.24 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
.PHONY: all
all: clean check generate build
VERSION := $(shell git describe --dirty --tags --always)
override BUILD_OPTS += -ldflags '-w -X main.Version=$(VERSION)'
BINARY := bin
$(BINARY):
mkdir -p bin
GOIMPORTS := bin/goimports
$(GOIMPORTS): $(BINARY)
go build -o $@ golang.org/x/tools/cmd/goimports
GOLINT := bin/golint
$(GOLINT): $(BINARY)
go build -o $@ golang.org/x/lint/golint
GINKGO := bin/ginkgo
$(GINKGO): $(BINARY)
go build -o $@ github.com/onsi/ginkgo/ginkgo
MOCKERY_GEN := bin/mockery
$(MOCKERY_GEN): $(BINARY)
go build -o $@ github.com/vektra/mockery/v2
bin/course-data-api: generate
go build $(BUILD_OPTS) -o $@ .
.PHONY: clean
clean:
rm -rf bin/
find . -type f 'mock_*.go' -exec rm{} +
.PHONY: check
check: fmt lint vet
.PHONY: fmt
fmt: $(GOIMPORTS)
@echo "Formatting go files"
find . -type f '*.go' | xargs $(GOIMPORTS) -w
go fmt ./...
.PHONY: lint
lint: $(GOLINT)
$(GOLINT) ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: test
test:
go test $(shell go list ./... | grep -v test) -coverprofile cover.out
.PHONY: generate
generate: $(MOCKERY_GEN)
go generate ./...
.PHONY: build
build: bin/course-data-api
.PHONY: e2e_test
e2e_test: generate $(GINKGO)
$(GINKGO) -noColor -nodes=10 -timeout=5m -flakeAttempts=5 ./test/...