-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (56 loc) · 1.62 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
68
69
70
71
#!make
-include env.conf
VERSION:=$(shell git describe --tags)
COMMIT:=$(shell git rev-parse HEAD)
BUILT:=$(shell date +%FT%T%z)
BASE_PKG:=github.com/Setheck/tweetstreem
IMAGE:=setheck/tweetstreem
LDFLAGS=-ldflags "-w -s \
-X ${BASE_PKG}/app.Version=${VERSION} \
-X ${BASE_PKG}/app.Built=${BUILT} \
-X ${BASE_PKG}/app.Commit=${COMMIT} \
-X ${BASE_PKG}/twitter.AppToken=${APP_TOKEN} \
-X ${BASE_PKG}/twitter.AppSecret=${APP_SECRET}"
test:
go test ./... -cover -v -race
coverage:
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
build: GOOS=linux
build:
GOOS=$(GOOS) go build ${LDFLAGS} -o tweetstreem
buildwin: GOOS=windows
buildwin:
GOOS=$(GOOS) go build ${LDFLAGS} -o tweetstreem_win.exe
buildmac: GOOS=darwin
buildmac:
GOOS=$(GOOS) go build ${LDFLAGS} -o tweetstreem_mac
buildarm: GOOS=linux
buildarm: GOARCH=arm
buildarm:
GOOS=$(GOOS) go build ${LDFLAGS} -o tweetstreem_arm
tokencheck:
@if [ -z "${APP_TOKEN}" ]; then echo "APP_TOKEN Not Set"; exit 1; fi
@if [ -z "${APP_SECRET}" ]; then echo "APP_SECRET Not Set"; exit 1; fi
package:
mkdir -p deploy/
mv tweetstreem* deploy/
tar -czf tweetstreem.tar.gz deploy
dbuild:
exit 1 #no docker for now
# *Note, docker file calls `make build`
docker build . -t ${IMAGE}:latest
docker run --rm ${IMAGE}:latest -version
tag: MAJOR=0
tag: MINOR=3
tag: PATCH=0
tag:
git tag "v${MAJOR}.${MINOR}.${PATCH}"
git push origin --tags
ddeploy: clean dbuild
docker tag ${IMAGE}:latest ${IMAGE}:${VERSION}
docker push ${IMAGE}:latest
docker push ${IMAGE}:${VERSION}
clean:
rm -rf tweetstreem* deploy
.PHONY: test build dbuild clean tag tokencheck