-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
65 lines (46 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
60
61
62
63
64
65
COMMIT=$(shell git rev-parse HEAD)
VERSION=$(shell git describe --tags --exact-match --always)
DATE=$(shell date +'%FT%TZ%z')
CONTAINER_NAME ?= vegeta
SERVER_DIR = cmd/server
all: deps fmt lint build test
build: deps fmt
CGO_ENABLED=0 go build -v -o bin/vegeta-server -a -tags=netgo \
-ldflags '-s -w -extldflags "-static" -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)' ${SERVER_DIR}/main.go
clean:
rm -f coverage.txt
rm -rf bin
rm -rf vendor
deps:
go mod vendor
go mod download
update-deps:
go mod verify
go mod tidy
install:
$(shell ./scripts/make-install.sh)
test:
go clean -testcache ./...
go test -v -race -covermode=atomic ./...
go clean -testcache ./...
go test -v -covermode=count -coverprofile=profile.cov ./...
fmt:
go fmt ./...
validate:
golangci-lint run
lint:
golint cmd/... internal/... models/... pkg/...
go vet ${SERVER_DIR}/main.go
ineffassign:
ineffassign .
run: build
$(shell bin/vegeta-server --ip=localhost --port=8000)
container:
docker build -t vegeta-server:latest .
container_stop:
@docker rm -f '$(CONTAINER_NAME)' || true
container_run: container
@docker run --rm -d -p 8000:80 --name '$(CONTAINER_NAME)' vegeta-server:latest
container_clean: container_stop
@docker image rm vegeta-server:latest || true
.PHONY: all build clean deps update-deps install test fmt validate lint ineffassign run