forked from matbarofex/mtz-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (38 loc) · 1.13 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
SVC_NAME := $(shell grep 'const ServiceName' pkg/version.go | cut -f2 -d '"')
APP_VSN := $(shell grep 'const Version' pkg/version.go | cut -f2 -d '"')
GIT_COMMIT := $(shell git rev-parse HEAD)
BUILD_DATE := $(shell date --iso-8601=seconds)
IMAGE_NAME := mtzio/${SVC_NAME}
.PHONY: build
build:
go build -o mtz-crypto-service ./cmd/...
.PHONY: build-race
build-race:
go build -race -o mtz-crypto-service ./cmd/...
.PHONY: generate-mocks
generate-mocks:
mockery --all
.PHONY: test
test: build
go test -v -race -coverprofile=coverage.out ./pkg/...
go tool cover -func=coverage.out
.PHONY: lint
lint:
golangci-lint run
.PHONY: load-test
load-test:
h2load --h1 -c 50 -t 4 -D 10 --warm-up-time=2s -i test-urls.txt -B 'http://localhost:8000'
.PHONY: docker-build
docker-build:
docker build \
--build-arg SVC_NAME="$(SVC_NAME)" \
--build-arg APP_VSN="$(APP_VSN)" \
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
--build-arg BUILD_DATE="$(BUILD_DATE)" \
-t $(IMAGE_NAME):$(APP_VSN)-$(GIT_COMMIT) \
-t $(IMAGE_NAME):latest \
.
.PHONY: docker-push
docker-push:
docker push $(IMAGE_NAME):$(APP_VSN)-$(GIT_COMMIT)
docker push $(IMAGE_NAME):latest