From 66df20cb1dc61e565fff6730e63c7980a026930b Mon Sep 17 00:00:00 2001 From: bigeagle Date: Sun, 10 Apr 2016 22:40:48 +0800 Subject: [PATCH] chore: travis CI and coverall integration --- .testandcover.bash | 31 +++++++++++++++++++++++++++++++ .testpackages.txt | 2 ++ .travis.yml | 16 ++++++++++++++++ README.md | 9 +++++---- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 .testandcover.bash create mode 100644 .testpackages.txt create mode 100644 .travis.yml diff --git a/.testandcover.bash b/.testandcover.bash new file mode 100755 index 0000000..8f88b18 --- /dev/null +++ b/.testandcover.bash @@ -0,0 +1,31 @@ +#!/bin/bash + + +function die() { + echo $* + exit 1 +} + +export GOPATH=`pwd`:$GOPATH + +# Initialize profile.cov +echo "mode: count" > profile.cov + +# Initialize error tracking +ERROR="" + +# Test each package and append coverage profile info to profile.cov +for pkg in `cat .testpackages.txt` +do + #$HOME/gopath/bin/ + go test -v -covermode=count -coverprofile=profile_tmp.cov $pkg || ERROR="Error testing $pkg" + + [ -f profile_tmp.cov ] && { + tail -n +2 profile_tmp.cov >> profile.cov || die "Unable to append coverage for $pkg" + } +done + +if [ ! -z "$ERROR" ] +then + die "Encountered error, last error was: $ERROR" +fi diff --git a/.testpackages.txt b/.testpackages.txt new file mode 100644 index 0000000..ba04577 --- /dev/null +++ b/.testpackages.txt @@ -0,0 +1,2 @@ +github.com/tuna/tunasync/internal +github.com/tuna/tunasync/manager diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d6a4831 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: go +go: + - 1.6 + +before_install: + - go get golang.org/x/tools/cmd/cover + - go get -v github.com/mattn/goveralls + +os: + - linux + +script: + - ./.testandcover.bash + +after_success: + - goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/README.md b/README.md index 3a68297..485cba9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ tunasync ======== -## Ideas - -- use [etcd](https://github.com/coreos/etcd) to store configurations and state variables +[![Build Status](https://travis-ci.org/tuna/tunasync.svg?branch=dev)](https://travis-ci.org/tuna/tunasync) +[![Coverage Status](https://coveralls.io/repos/github/tuna/tunasync/badge.svg?branch=dev)](https://coveralls.io/github/tuna/tunasync?branch=dev) ## Design @@ -39,7 +38,9 @@ tunasync ## TODO - [ ] split to `tunasync-manager` and `tunasync-worker` instances - - use HTTP as communication protocol + - [ ] use HTTP as communication protocol + - [ ] implement manager as status server first, and use python worker + - [ ] implement go worker - Web frontend for `tunasync-manager` - [ ] start/stop/restart job - [ ] enable/disable mirror