forked from raystack/raccoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (47 loc) · 1.28 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
66
67
68
.PHONY: all
ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
APP_EXECUTABLE="raccoon"
COVER_FILE="/tmp/coverage.out"
all: setup compile
# Setups
setup: copy-config
make update-deps
update-deps:
go mod tidy -v
go mod vendor
copy-config:
cp .env.sample .env
# Build Lifecycle
compile:
go build -o $(APP_EXECUTABLE)
build: copy-config update-deps compile
install:
go install $(ALL_PACKAGES)
start: build
./$(APP_EXECUTABLE)
# Utility
fmt:
go fmt $(ALL_PACKAGES)
vet:
go vet $(ALL_PACKAGES)
lint:
@for p in $(ALL_PACKAGES); do \
echo "==> Linting $$p"; \
golint $$p | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; } \
done
# Tests
test: lint
ENVIRONMENT=test go test $(shell go list ./... | grep -v "vendor" | grep -v "integration") -v
@go list ./... | grep -v "vendor" | grep -v "integration" | xargs go test -count 1 -cover -short -race -timeout 1m -coverprofile ${COVER_FILE}
@go tool cover -func ${COVER_FILE} | tail -1 | xargs echo test coverage:
test-bench: # run benchmark tests
@go test $(shell go list ./... | grep -v "vendor") -v -bench ./... -run=^Benchmark
test_ci: setup test
# Docker Run
docker-run:
docker-compose build
docker-compose up -d
docker-stop:
docker-compose stop
docker-start:
docker-compose start