From fda0066d64fc0291f914016f912a17bc26a1937d Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Wed, 17 May 2017 16:22:58 +0200 Subject: [PATCH] [TASK] add travis-ci, circle-ci and coveralls --- .test-coverage | 28 ++++++++++++++++++++++++++++ .travis.yml | 5 +++++ circle.yml | 18 ++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100755 .test-coverage create mode 100644 .travis.yml create mode 100644 circle.yml diff --git a/.test-coverage b/.test-coverage new file mode 100755 index 0000000..7cfce2d --- /dev/null +++ b/.test-coverage @@ -0,0 +1,28 @@ +#!/bin/bash +# Issue: https://github.com/mattn/goveralls/issues/20 +# Source: https://github.com/uber/go-torch/blob/63da5d33a225c195fea84610e2456d5f722f3963/.test-cover.sh +CI=$1 +echo "run for $CI" + +echo "mode: count" > profile.cov +FAIL=0 + +# Standard go tooling behavior is to ignore dirs with leading underscors +for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); +do + if ls $dir/*.go &> /dev/null; then + go test -p 1 -v -covermode=count -coverprofile=profile.tmp $dir || FAIL=$? + if [ -f profile.tmp ] + then + tail -n +2 < profile.tmp >> profile.cov + rm profile.tmp + fi + fi +done + +# Failures have incomplete results, so don't send +if [ "$FAIL" -eq 0 ]; then + goveralls -service=$CI -v -coverprofile=profile.cov +fi + +exit $FAIL diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9650225 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: go +go: + - tip +install: + - go get -t github.com/genofire/golang-lib/... diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..d151290 --- /dev/null +++ b/circle.yml @@ -0,0 +1,18 @@ +machine: + environment: + GOROOT: "" + PATH: "/usr/local/go/bin:/usr/local/go_workspace/bin:~/.go_workspace/bin:${PATH}" + GOPATH: "${HOME}/.go_workspace" + +dependencies: + override: + - mkdir -p ~/.go_workspace/src/github.com/${CIRCLE_PROJECT_USERNAME} + - ln -s ${HOME}/${CIRCLE_PROJECT_REPONAME} ${HOME}/.go_workspace/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} + - go get -t -d -v ./... + +test: + pre: + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover + override: + - ./.test-coverage circle-ci