Add circle ci config and test script.

This commit is contained in:
Tom Wilkie
2015-05-18 14:21:54 +00:00
parent ea382b1e1b
commit 4598d37ecd
4 changed files with 52 additions and 11 deletions

View File

@@ -10,10 +10,8 @@ FIXPROBE_EXE=experimental/fixprobe/fixprobe
SCOPE_IMAGE=$(DOCKERHUB_USER)/scope
SCOPE_EXPORT=scope.tar
all: build
build:
go build ./...
all: $(APP_EXE) $(PROBE_EXE)
dist: client static $(APP_EXE) $(PROBE_EXE)
client:
cd client && make build && rm -f dist/.htaccess
@@ -22,21 +20,20 @@ static:
go get github.com/mjibson/esc
cd app && esc -o static.go -prefix ../client/dist ../client/dist
dist: client static build
test: $(APP_EXE) $(FIXPROBE_EXE)
# app and fixprobe needed for integration tests
go test ./...
$(APP_EXE):
cd app && go build
$(APP_EXE): app/*.go report/*.go xfer/*.go
$(PROBE_EXE): probe/*.go report/*.go xfer/*.go
$(APP_EXE) $(PROBE_EXE):
go get -tags netgo ./$(@D)
go build -o $@ ./$(@D)
$(FIXPROBE_EXE):
cd experimental/fixprobe && go build
$(PROBE_EXE):
cd probe && go build
$(SCOPE_EXPORT): Dockerfile $(APP_EXE) $(PROBE_EXE) entrypoint.sh supervisord.conf
$(SUDO) docker build -t $(SCOPE_IMAGE) .
$(SUDO) docker save $(SCOPE_IMAGE):latest > $@

19
bin/test Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
echo "mode: count" > profile.cov
fail=0
for dir in $(find . -type f -name '*_test.go' | xargs -n1 dirname | sort -u); do
if [ -e $dir/no_test ]; then
continue
fi
output=$(mktemp cover.XXXXXXXXXX)
if ! go test -tags netgo -covermode=count -coverprofile=$output $dir ; then
fail=1
fi
if [ -f $output ]; then
tail -n +2 <$output >>profile.cov
rm $output
fi
done
go tool cover -html=profile.cov -o=coverage.html
exit $fail

25
circle.yml Normal file
View File

@@ -0,0 +1,25 @@
general:
branches:
ignore:
- gh-pages
machine:
services:
- docker
environment:
GOPATH: /home/ubuntu:$GOPATH
SRCDIR: /home/ubuntu/src/github.com/weaveworks/scope
PATH: $PATH:$HOME/.local/bin
dependencies:
post:
- go get github.com/mattn/goveralls
- mkdir -p $(dirname $SRCDIR)
- cp -r $(pwd)/ $SRCDIR
test:
override:
- cd $SRCDIR; make
- cd $SRCDIR; ./bin/test
post:
- goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/profile.cov -service=circleci

0
integration/no_test Normal file
View File