-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
41 lines (33 loc) · 934 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
41
VERSION ?= latest
# Create a variable that contains the current date in UTC
# Different flow if this script is running on Darwin or Linux machines.
ifeq (Darwin,$(shell uname))
NOW_DATE = $(shell date -u +%d-%m-%Y)
else
NOW_DATE = $(shell date -u -I)
endif
all: test
.PHONY: mongo-start
mongo-start:
docker run --rm --name mongo -p 27017:27017 -d mongo
.PHONY: test
test: clean mongo-start
go test ./... -cover -race -count=1
$(MAKE) clean
.PHONY: coverage
coverage: clean mongo-start
go test ./... -coverprofile coverage.out -count=1 -race=1
$(MAKE) clean
.PHONY: bench
bench: clean mongo-start
go test -benchmem -bench=^Bench ./... -run=^Bench
.PHONY: clean
clean:
docker rm mongo --force
.PHONY: version
version:
sed -i.bck "s|SERVICE_VERSION=\"[0-9]*.[0-9]*.[0-9]*.*\"|SERVICE_VERSION=\"${VERSION}\"|" "Dockerfile"
rm -fr "Dockerfile.bck"
git add "Dockerfile"
git commit -m "v${VERSION}"
git tag v${VERSION}