-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (27 loc) · 961 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
37
38
39
40
NAME = fizzbuzzd
GOPATH ?= ${HOME}/go
LDFLAGS=-ldflags "-X main.version=${VERSION}"
default: build
build: clean fmt dep lint test
go build -i -v ${LDFLAGS} -o ${NAME} ./cmd/fizzbuzzd
dep:
if [ -f "Gopkg.toml" ] ; then dep ensure ; else dep init ; fi
clean:
if [ -f "${NAME}" ] ; then rm ${NAME} ; fi
lint:
${GOPATH}/bin/gometalinter.v2 go --vendor --tests --errors --concurrency=2 --deadline=60s ./...
fmt:
go fmt ./...
test:
go test -v ./...
blackbox-test: image
VERSION=${VERSION} docker-compose -f ./test/docker-compose.yml up -d --force-recreate
docker run --rm --net=fizzbuzzd-network -v ${GOPATH}:/go -i golang go test -v github.com/fkarakas/fizzbuzzd/test/... -tags=blackbox
VERSION=${VERSION} docker-compose -f ./test/docker-compose.yml down
image: check-version
docker build --rm . -t fkarakas/${NAME}:${VERSION} --build-arg VERSION=${VERSION}
check-version:
ifndef VERSION
$(error VERSION is undefined)
endif
.PHONY: test image