Skip to content

Commit

Permalink
Improve build script
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Feb 18, 2017
1 parent e40da8e commit 119259c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ templates.go: templates/*.html monitor.go
go generate

.PHONY: test
test:
go test $(go list ./... | grep -v /vendor/)
test: .PHONY
go test $(shell go list ./... | grep -v /vendor/)

testrace: .PHONY
go test -race $(shell go list ./... | grep -v /vendor/)
Expand Down
13 changes: 10 additions & 3 deletions build
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/bin/sh
echo building
# git describe --always --tags --dirty --long)
REVISION=`git rev-parse --short=5 HEAD`
BUILDTIME=`TZ=UTC date "+%Y-%m-%dT%H:%MZ"`
echo $REVISION > REVISION
go build \
-ldflags "-X main.gitVersion $REVISION -X main.buildTime $BUILDTIME" \
-v

OS=`go env GOOS`
ARCH=`go env GOARCH`

go build -i -o geodns-$OS-$ARCH \
-ldflags "-X main.gitVersion=$REVISION -X main.buildTime=$BUILDTIME" \
-v && \
(cd geodns-influxdb && go build -i -v -o geodns-influxdb-$OS-$ARCH && cd ..) && \
tar cvf geodns-$OS-$ARCH.tar geodns-$OS-$ARCH geodns-influxdb/geodns-influxdb-$OS-$ARCH service service-influxdb

0 comments on commit 119259c

Please sign in to comment.