Add Makefile to coordinate builds
parent
fa8d2d912b
commit
d40f53913e
|
@ -0,0 +1,30 @@
|
|||
VERSION ?= $$(git describe --always --tags)
|
||||
COMMIT ?= $$(git rev-parse --short=8 HEAD)
|
||||
BRANCH ?= $$(git rev-parse --abbrev-ref HEAD | tr / _)
|
||||
BUILD_TIME ?= $$(date +%FT%T%z)
|
||||
|
||||
SOURCES := $(shell find . -name '*.go')
|
||||
|
||||
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildTime=${BUILD_TIME} -X main.Branch=${BRANCH}"
|
||||
BINARY=mrfusion
|
||||
|
||||
default: prepare ${BINARY}
|
||||
|
||||
${BINARY}: $(SOURCES)
|
||||
go build -o ${BINARY} ${LDFLAGS} ./cmd/mr-fusion-server/main.go
|
||||
|
||||
docker-${BINARY}: $(SOURCES)
|
||||
CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
|
||||
./cmd/mr-fusion-server/main.go
|
||||
|
||||
prepare:
|
||||
go get github.com/sparrc/gdm
|
||||
gdm restore
|
||||
|
||||
clean:
|
||||
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
||||
|
||||
test:
|
||||
go test -race ./...
|
||||
|
||||
.PHONY: clean test
|
13
circle.yml
13
circle.yml
|
@ -2,19 +2,24 @@
|
|||
machine:
|
||||
services:
|
||||
- docker
|
||||
post:
|
||||
- go version
|
||||
- go version | grep 1.7.1 || sudo rm -rf /usr/local/go
|
||||
- wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz
|
||||
- sudo tar -C /usr/local -xzf go1.7.1.linux-amd64.tar.gz
|
||||
- go version
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- git config --global url."git@github.com:".insteadOf "https://github.com/"
|
||||
- go get -u github.com/sparrc/gdm
|
||||
- gdm restore
|
||||
- make prepare
|
||||
override:
|
||||
- docker info
|
||||
- docker build --rm=false -t influxdata/mrfusion .
|
||||
|
||||
test:
|
||||
override:
|
||||
- go test -v -race ./...
|
||||
- make test
|
||||
- docker build --rm=false -t influxdata/mrfusion .
|
||||
- docker run -d -p 8080:5000 -e PORT=5000 influxdata/mrfusion; sleep 10
|
||||
- curl --retry 10 --retry-delay 5 -v http://localhost:8080
|
||||
|
||||
|
|
Loading…
Reference in New Issue