diff --git a/Makefile b/Makefile index ea66d8207..94736921b 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,9 @@ test: build test_race: build go test -race `${NOVENDOR}` +test_integrations: + bash ./test/test.sh + test100: build for i in {1..100}; do make test; done diff --git a/README.md b/README.md index 654e68196..38e2443d9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Simple, Secure, Scalable Blockchain Platform [![CircleCI](https://circleci.com/gh/tendermint/tendermint.svg?style=svg)](https://circleci.com/gh/tendermint/tendermint) +[![codecov](https://codecov.io/gh/tendermint/tendermint/branch/develop/graph/badge.svg)](https://codecov.io/gh/tendermint/tendermint) _NOTE: This is yet pre-alpha non-production-quality software._ diff --git a/circle.yml b/circle.yml index 98dd22283..ab7c23b96 100644 --- a/circle.yml +++ b/circle.yml @@ -16,8 +16,15 @@ checkout: dependencies: override: + - sudo curl -sSL -o /usr/bin/docker http://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.1-circleci; sudo chmod 0755 /usr/bin/docker + - sudo service docker start + - go version + - docker version - "cd $REPO && make get_vendor_deps" test: override: - "cd $REPO && make test_race" + - "cd $REPO && make test_integrations" + post: + - bash <(curl -s https://codecov.io/bash) diff --git a/glide.lock b/glide.lock index 910814635..4a4cbf9fd 100644 --- a/glide.lock +++ b/glide.lock @@ -80,7 +80,7 @@ imports: - name: github.com/tendermint/go-wire version: 3b0adbc86ed8425eaed98516165b6788d9f4de7a - name: github.com/tendermint/log15 - version: 6e460758f10ef42a4724b8e4a82fee59aaa0e41d + version: 9545b249b3aacafa97f79e0838b02b274adc6f5f subpackages: - term - name: github.com/tendermint/tmsp diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 000000000..613780e99 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,8 @@ +# Pull base image. +FROM golang:1.5 + +COPY test/test_libs.sh / +COPY glide.lock /glide.lock + +ENV GLIDE /glide.lock + diff --git a/test/test.sh b/test/test.sh new file mode 100644 index 000000000..b9d15d351 --- /dev/null +++ b/test/test.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +# integrations test! +# if we pushed to STAGING or MASTER, +# run the integrations tests. + +BRANCH=`git rev-parse --abbrev-ref HEAD` +echo "Current branch: $BRANCH" + +if [[ "$BRANCH" == "master" || "$BRANCH" == "staging" ]]; then + docker build -t tester -f ./test/Dockerfile . + docker run -t tester bash /test_libs.sh +fi + diff --git a/test/test_libs.sh b/test/test_libs.sh new file mode 100644 index 000000000..6824e3141 --- /dev/null +++ b/test/test_libs.sh @@ -0,0 +1,63 @@ +#! /bin/bash + +# set glide.lock path +if [[ "$GLIDE" == "" ]]; then + GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock +fi + +# get vendored commit for given lib +function parseGlide() { + cat $1 | grep -A1 $2 | grep -v $2 | awk '{print $2}' +} + +# fetch and checkout vendored dep +function getDep() { + lib=$1 + echo "----------------------------------" + echo "Getting $lib ..." + go get -t github.com/tendermint/$lib/... + + VENDORED=$(parseGlide $GLIDE $lib) + cd $GOPATH/src/github.com/tendermint/$lib + MASTER=$(git rev-parse origin/master) + + if [[ "$VENDORED" != "$MASTER" ]]; then + echo "... VENDORED != MASTER ($VENDORED != $MASTER)" + echo "... Checking out commit $VENDORED" + git checkout $VENDORED &> /dev/null + fi +} + +#################### +# libs we depend on +#################### + +LIBS_GO_TEST=(go-clist go-common go-config go-crypto go-db go-events go-merkle go-p2p) +LIBS_MAKE_TEST=(go-rpc go-wire tmsp) + +for lib in "${LIBS_GO_TEST[@]}"; do + getDep $lib + + echo "Testing $lib ..." + go test --race github.com/tendermint/$lib/... + if [[ "$?" != 0 ]]; then + echo "FAIL" + exit 1 + fi +done + + +for lib in "${LIBS_MAKE_TEST[@]}"; do + getDep $lib + + echo "Testing $lib ..." + cd $GOPATH/src/github.com/tendermint/$lib + make test + if [[ "$?" != 0 ]]; then + echo "FAIL" + exit 1 + fi +done + +echo "" +echo "PASS"