-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
65 lines (46 loc) · 1.63 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: clean docker-build test test-coverage test-bench mocks run run-cli dep lint air
all: test build/slack-bot build/cli
FLAGS = -trimpath -ldflags="-s -w -X github.com/innogames/slack-bot/v2/bot/version.Version=$(shell git describe --tags)"
build/slack-bot: dep
@mkdir -p build/
go build $(FLAGS) -o build/slack-bot cmd/bot/main.go
build/cli: dep
@mkdir -p build/
go build $(FLAGS) -o build/cli cmd/cli/main.go
run: dep
go run -tags pprof $(FLAGS) cmd/bot/*.go
run-cli: dep
@test -f config.yaml || (echo "please create a config.yaml first. Hint: check the config.example.yaml" && exit 1)
go run $(FLAGS) cmd/cli/main.go -config config.yaml
run-cli-config:
go run cmd/cli/main.go -config config.yaml
clean:
rm -rf build/
# download go dependencies into ./vendor/
dep:
@go mod vendor
lint:
golangci-lint run --fix
docker-build:
docker build . --force-rm -t brainexe/slack-bot:latest
docker-push:
docker push brainexe/slack-bot:latest
test: dep
go test ./...
test-race: dep
go test ./... -race
test-bench:
go test -bench . ./... -benchmem
test-coverage: dep
@mkdir -p build
go test ./... -coverpkg=./... -cover -coverprofile=./build/cover.out -covermode=atomic
go tool cover -html=./build/cover.out -o ./build/cover.html
@go tool cover -func ./build/cover.out | grep total | awk '{print "Total Coverage: " $$3 " see ./build/cover.html"}'
# build mocks for testable interfaces into ./mocks/ directory
mocks: dep
command -v mockery || go install github.com/vektra/mockery/v2@latest
go generate ./...
# live reload, see https://github.com/cosmtrek/air
run-live-reload:
command -v air || go install github.com/cosmtrek/air@latest
air