-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (47 loc) · 1.61 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build -ldflags="-w"
GOINSTALL=$(GOCMD) install
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GORUN=$(GOCMD) run
BINPATH=bin/
BINARYNAME=grgd
OS=darwin
PLATFORM=amd64
all: test build-native stats
test: mocks
$(GOTEST) ./...
build-native:
GO111MODULE=on $(GOBUILD) -o $(BINPATH)$(BINARYNAME)-$(OS)-$(PLATFORM)
run:
./$(BINPATH)$(BINARYNAME)
stats:
du -sh $(BINPATH)$(BINARYNAME)-$(OS)-$(PLATFORM)
cover:
$(GOTEST) -coverprofile=coverage.out -cover ./...
go tool cover -html=coverage.out
docker: docker-build-bin docker-build
docker-build-bin:
docker run --rm -it \
-v "$(GOPATH)":/go \
-v $(PWD):/src/ \
-w /src/ \
-e CGO_ENABLED=1 \
-e GO111MODULE=on \
-e GOOS=linux \
-e GOARCH=amd64 \
golang:latest \
$(GOBUILD) -ldflags="-w -s" \
-o ./$(BINPATH)$(BINARYNAME)-linux
tdd: mocks
fswatch -o ../* | xargs -n1 -I{} bash -c 'clear && $(GOTEST) ./...'
mocks:
@for f in interfaces/*.go; do \
echo generate $${f}; \
mockgen -imports interfaces/IConfig.go=github.com/gregod-com/grgd/interfaces,interfaces/ICore.go=github.com/gregod-com/grgd/interfaces,interfaces/IExtractor.go=github.com/gregod-com/grgd/interfaces,interfaces/IHelper.go=github.com/gregod-com/grgd/interfaces,interfaces/INetworker.go=github.com/gregod-com/grgd/interfaces,interfaces/IProfile.go=github.com/gregod-com/grgd/interfaces,interfaces/IProject.go=github.com/gregod-com/grgd/interfaces \
--source=$${f} -destination interfaces/mocks/mock`basename $${f}` -package mocks; \
done
proto:
protoc --go_out=../ protobuf/*.proto