-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
67 lines (55 loc) · 1.5 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
GOPATH ?= $(HOME)/go
GOBIN ?= $(HOME)/bin
VERSION = $(shell git describe --tags --always --dirty)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
DOCKER_IMAGE = sshexecutor
all: help
help:
@echo
@echo "VERSION: $(VERSION)"
@echo "BRANCH: $(BRANCH)"
@echo
@echo "usage: make <command>"
@echo
@echo "commands:"
@echo " mod - populate vendor/ without updating it first"
@echo " build - build apps and installs them in $(GOBIN)"
@echo " test - run unit tests"
@echo " coverage - run unit tests and show coaverage on browser"
@echo " clean - remove generated files and directories"
@echo " run - start the service locally, NOT AS A DOCKER CONAINER"
@echo " docker-build - build the docker image"
@echo " docker-run - use docker-compose to run the service docker image"
@echo
@echo "GOPATH: $(GOPATH)"
@echo "GOBIN: $(GOBIN)"
@echo
mod:
@echo ">>> Populating vendor folder..."
@go mod vendor
build:
@echo ">>> Building app..."
go install -v ./...
@echo
test:
@echo ">>> Running tests..."
go test -count=1 -v ./...
@echo
coverage:
go test ./... -v -coverprofile=coverage.out && go tool cover -html=coverage.out
clean:
@echo ">>> Cleaning..."
go clean -i -r -cache -testcache
@echo
run:
@echo ">>> Running ..."
go run ./pkg/cmd/main.go
@echo
docker-build:
@echo ">>> Docker image building ..."
docker build --network=host -t $(DOCKER_IMAGE) .
@echo
docker-run:
@echo ">>> Running Docker image ..."
docker-compose up $(DOCKER_IMAGE)
@echo