add codacy config and coverage targets

This commit is contained in:
Michael Hobbs
2017-10-02 14:19:14 -07:00
parent 5b3506584a
commit bbb38031f0
4 changed files with 22 additions and 3 deletions

View File

@@ -20,10 +20,12 @@ jobs:
- run: |
case $CIRCLE_NODE_INDEX in
0) sudo -E make -e lint ;;
1) sudo -E make -e go-tests ;;
1) sudo -E make -e go-tests ci-go-coverage;;
2) sudo -E make -e deploy-test-checks-root deploy-test-config deploy-test-multi deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;;
esac
- run:
shell: /bin/bash
command: sudo -E make -e test-ci
no_output_timeout: 60m
- store_artifacts:
path: ./coverage.out

5
.codacy.yml Normal file
View File

@@ -0,0 +1,5 @@
exclude_paths:
- vendor/**/*
- tests/**/*
- "**_test.go"
- contrib/*

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@
data/
stack.tgz
tmp
coverage.out

View File

@@ -73,6 +73,16 @@ lint:
@echo linting...
@$(QUIET) find . -not -path '*/\.*' -not -path './debian/*' -type f | xargs file | grep text | awk -F ':' '{ print $$1 }' | xargs head -n1 | egrep -B1 "bash" | grep "==>" | awk '{ print $$2 }' | xargs shellcheck -e SC2034
ci-go-coverage:
docker run --rm -ti \
-e DOKKU_ROOT=/home/dokku \
-e CODACY_TOKEN=$$CODACY_TOKEN \
-e CIRCLE_SHA1=$$CIRCLE_SHA1 \
-v $$PWD:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT) \
$(BUILD_IMAGE) \
bash -c "go get github.com/schrej/godacov && godacov -t $$CODACY_TOKEN -r ./coverage.out -c $$CIRCLE_SHA1" || exit $$?
go-tests:
@echo running go unit tests...
docker run --rm -ti \
@@ -80,8 +90,9 @@ go-tests:
-v $$PWD:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT) \
$(BUILD_IMAGE) \
bash -c "go get github.com/onsi/gomega && \
go list ./... | grep -v /vendor/ | grep -v /tests/apps/ | xargs go test -v -p 1 -race" || exit $$?
bash -c "go get github.com/onsi/gomega github.com/haya14busa/goverage && \
go list ./... | egrep -v '/vendor/|/tests/apps/' | xargs go test -v -p 1 -race && \
go list ./... | egrep -v '/vendor/|/tests/apps/' | xargs goverage -v -coverprofile=coverage.out" || exit $$?
unit-tests: go-tests
@echo running bats unit tests...