Merge pull request #55 from influxdata/feature/circle-tests

Add Makefile and update circle to run golang tests
pull/58/head
Chris Goller 2016-09-15 18:41:28 -05:00 committed by GitHub
commit af3e09180d
2 changed files with 42 additions and 1 deletions

30
Makefile Normal file
View File

@ -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

View File

@ -2,13 +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/"
- mkdir -p ${HOME}/.go_workspace/src/github.com/influxdata
- ln -sf ${HOME}/mrfusion ${HOME}/.go_workspace/src/github.com/influxdata
- cd ${HOME}/.go_workspace/src/github.com/influxdata/mrfusion && make
override:
- docker info
- docker build --rm=false -t influxdata/mrfusion .
test:
override:
- 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