diff --git a/Makefile b/Makefile index a0e4f6da9..4469e5a49 100644 --- a/Makefile +++ b/Makefile @@ -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 > $@ diff --git a/bin/test b/bin/test new file mode 100755 index 000000000..2a4933d4f --- /dev/null +++ b/bin/test @@ -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 diff --git a/circle.yml b/circle.yml new file mode 100644 index 000000000..476bf079e --- /dev/null +++ b/circle.yml @@ -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 diff --git a/integration/no_test b/integration/no_test new file mode 100644 index 000000000..e69de29bb