From 8fd216b4f65bbe79ebf4c83a63e241a10e3f56d2 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 23 Jul 2016 19:38:44 -0400 Subject: [PATCH] run CI tests in docker container --- Makefile | 2 +- circle.yml | 2 -- glide.lock | 2 +- test/Dockerfile | 11 +++++------ test/run_test.sh | 14 ++++++++++++++ test/test.sh | 20 +++++++++----------- 6 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 test/run_test.sh diff --git a/Makefile b/Makefile index 94736921..6a3b2381 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ test: build test_race: build go test -race `${NOVENDOR}` -test_integrations: +test_integrations: bash ./test/test.sh test100: build diff --git a/circle.yml b/circle.yml index ab7c23b9..95d5bfab 100644 --- a/circle.yml +++ b/circle.yml @@ -20,11 +20,9 @@ dependencies: - 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 4a4cbf9f..ce301894 100644 --- a/glide.lock +++ b/glide.lock @@ -45,7 +45,7 @@ imports: - leveldb/table - leveldb/util - name: github.com/tendermint/ed25519 - version: fdac6641497281ed1cc368687ec6377e96e02b24 + version: 1f52c6f8b8a5c7908aff4497c186af344b428925 subpackages: - extra25519 - edwards25519 diff --git a/test/Dockerfile b/test/Dockerfile index 613780e9..9978d367 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,8 +1,7 @@ # Pull base image. -FROM golang:1.5 - -COPY test/test_libs.sh / -COPY glide.lock /glide.lock - -ENV GLIDE /glide.lock +FROM golang:1.6 +ENV TENDERMINT_ORG $GOPATH/src/github.com/tendermint/ +RUN mkdir -p $TENDERMINT_ORG +COPY . $TENDERMINT_ORG/tendermint +WORKDIR $TENDERMINT_ORG/tendermint diff --git a/test/run_test.sh b/test/run_test.sh new file mode 100644 index 00000000..67d1f23c --- /dev/null +++ b/test/run_test.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +echo `pwd` + +BRANCH=`git rev-parse --abbrev-ref HEAD` +echo "Current branch: $BRANCH" + +make get_vendor_deps + +make test_race + +if [[ "$BRANCH" == "master" || "$BRANCH" == "staging" ]]; then + bash test/test_libs.sh +fi diff --git a/test/test.sh b/test/test.sh index b9d15d35..5c646c27 100644 --- a/test/test.sh +++ b/test/test.sh @@ -1,14 +1,12 @@ #! /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 +# integrations test +# this is the script run by eg CircleCI. +# It creates a docker container, +# installs the dependencies, +# and runs the tests. +# If we pushed to STAGING or MASTER, +# it will also run the tests for all dependencies +docker build -t tester -f ./test/Dockerfile . +docker run -t tester bash test/run_test.sh