Skip to content

Commit 1a03e11

Browse files
committed
Add support for coveralls.io
1 parent 626a2f7 commit 1a03e11

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.env
22
*.test
3+
*.coverprofile

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
before_install:
22
- go get -u github.com/stretchr/testify/require
33

4+
# Install code coverage / coveralls tooling
5+
- go get -u golang.org/x/tools/cmd/cover
6+
- go get -u github.com/modocache/gover
7+
- go get -u github.com/mattn/goveralls
8+
49
# Unpack and start the Stripe API stub so that the test suite can talk to it
510
- |
611
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
@@ -35,5 +40,12 @@ matrix:
3540

3641
script:
3742
- make
43+
- make coverage
44+
45+
after_script:
46+
# Merge all coverage reports located in subdirectories and put them under: gover.coverprofile
47+
- gover
48+
# Send code coverage report to coveralls.io
49+
- goveralls -service=travis-ci -coverprofile=gover.coverprofile
3850

3951
sudo: false

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@ test:
1414

1515
vet:
1616
go vet ./...
17+
18+
coverage:
19+
# go currently cannot create coverage profiles when testing multiple packages, so we test each package
20+
# independently. This issue should be fixed in Go 1.10 (https://github.com/golang/go/issues/6909).
21+
go list ./... | xargs -n1 -I {} -P 4 go test -covermode=count -coverprofile=../../../{}/profile.coverprofile {}
22+
23+
clean:
24+
find . -name \*.coverprofile -delete

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Go Stripe [![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/stripe/stripe-go) [![Build Status](https://travis-ci.org/stripe/stripe-go.svg?branch=master)](https://travis-ci.org/stripe/stripe-go)
1+
# Go Stripe
2+
3+
[![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/stripe/stripe-go)
4+
[![Build Status](https://travis-ci.org/stripe/stripe-go.svg?branch=master)](https://travis-ci.org/stripe/stripe-go)
5+
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-go/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-go?branch=master)
26

37
## Summary
48

0 commit comments

Comments
 (0)