3
0

upd(all): produce an accurate code coverage (#120)

Signed-off-by: Tit Petric <black@scene-si.org>
This commit is contained in:
Tit Petric 2019-05-19 14:31:36 +02:00 committed by GitHub
parent 537a8d2060
commit ccc50012ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 3 deletions

View File

@ -15,7 +15,6 @@ steps:
GOARCH: amd64
CI: circleci
commands:
- make codegen
- make test
- name: api-system
@ -100,14 +99,13 @@ steps:
COMPOSE_DB_DSN: crust:crust@tcp(crust-db:3306)/crust?collation=utf8mb4_general_ci
MESSAGING_DB_DSN: crust:crust@tcp(crust-db:3306)/crust?collation=utf8mb4_general_ci
commands:
- make codegen
- go build ./cmd/...
- wait-for-it.sh -t 60 --strict crust-db:3306 -- echo "Crust DB1 is up"
- gotest -v --tags="migrations" ./system/db/...
- gotest -v --tags="migrations" ./compose/db/...
- gotest -v --tags="migrations" ./messaging/db/...
- go test -run=^$ --tags="integration" ./cmd/... ./internal/... ./compose/... ./messaging/... ./system/...
- gotest -failfast --coverprofile=coverage.txt -v --tags="integration" ./internal/... ./system/... ./compose/... ./messaging/...
- make test-coverage
- name: coverage
image: plugins/codecov

2
.gitignore vendored
View File

@ -4,6 +4,8 @@
/.env*
/.dev*
/.cover*
/overalls*
profile.coverprofile
/public_html
/build
/var

View File

@ -3,6 +3,7 @@ FROM golang:1.12-alpine
ENV CGO_ENABLED=0
RUN apk add --no-cache git make bash && \
echo "installing overalls" && go get -u github.com/go-playground/overalls && \
echo "installing gomock" && go get -u github.com/golang/mock/gomock && \
echo "installing mockgen" && go get -u github.com/golang/mock/mockgen && \
echo "installing gotest" && go get -u github.com/rakyll/gotest && \

View File

@ -68,6 +68,10 @@ test:
# Run basic unit tests
$(GO) test ./cmd/... ./internal/... ./compose/... ./messaging/... ./system/...
test-coverage:
overalls -project=github.com/crusttech/crust -covermode=count -debug -- -coverpkg=./... --tags=integration
mv overalls.coverprofile coverage.txt
test.internal: $(GOTEST)
$(GOTEST) -covermode count -coverprofile .cover.out -v ./internal/...
$(GO) tool cover -func=.cover.out

2
codecov.yml Normal file
View File

@ -0,0 +1,2 @@
ignore:
- vendor/.*