-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
59 lines (42 loc) · 1.36 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
.PHONY: all test clean build install
GIT_TAG =
GO_FLAGS = -ldflags "-X 'github.com/leighmacdonald/mika/consts.BuildVersion=`git describe --abbrev=0`'"
DEBUG_FLAGS = -gcflags "all=-N -l"
# .RECIPEPREFIX = >
all: build
vet:
@go vet . ./...
fmt:
@go fmt . ./...
build_debug: protoc
@go build $(DEBUG_FLAGS) $(GO_FLAGS) -o mika
build: fmt
@go build $(GO_FLAGS)
run:
@go run $(GO_FLAGS) -race main.go
install: deps
@go install $(GO_FLAGS) ./...
test:
@go test $(GO_FLAGS) -race -cover . ./...
testcover:
@go test -race -coverprofile c.out $(GO_FLAGS) ./...
lint: protoc
@golangci-lint run
bench:
@go test -run=NONE -bench=. $(GO_FLAGS) ./...
clean:
@go clean $(GO_FLAGS) -i
image_latest:
@docker build -t leighmacdonald/mika:latest .
image_tag:
docker build -t leighmacdonald/mika:$$(git describe --abbrev=0 --tags) .
docker_run: image_latest
@docker-compose run --rm mika
mysql_schema:
@mysqldump -u mika -pmika mika -d --skip-add-drop-table --skip-dump-date -r store/mysql/schema.sql --skip-set-charset
@sed -i 's/^CREATE TABLE/CREATE TABLE IF NOT EXISTS/g' store/mysql/schema.sql
echo "Generated schema: store/mysql/schema.sql"
protoc:
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/common.proto proto/config.proto proto/user.proto proto/tracker.proto proto/role.proto proto/mika.proto
## EOF