-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
36 lines (27 loc) · 968 Bytes
/
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
# This how we want to name the binary output
BINARY=yandex-kassa-example
# These are the values we want to pass for VERSION and BUILD
VERSION=0.0.1
BUILD=`git rev-parse HEAD`
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
all : build
# Builds the project
build:
go build ${LDFLAGS} -o ./bin/${BINARY}
# Cleans our project: deletes binaries
clean:
if [ -f bin/${BINARY} ] ; then rm bin/${BINARY} ; fi
if [ -f coverage.html ] ; then rm coverage.html ; fi
docker-compose down --rmi all -v 2>/dev/null || true
if [ -d .cover ] ; then rm -rf .cover || true ; fi
docker-compose stop >/dev/null
docker-compose rm >/dev/null
rebuild:
docker-compose build unit
unit:
docker-compose down -v
docker-compose run --rm unit
coverage:
docker-compose run --rm unit && [ -f ./coverage.html ] && xdg-open coverage.html
.PHONY: all build clean unit rebuild coverage