deis / builder

Git server and application builder for Deis Workflow
https://deis.com
MIT License
40 stars 41 forks source link

docs(README): add codecov.io badge #314

Closed mboersma closed 8 years ago

mboersma commented 8 years ago

Summary of Changes

make test-cover runs the go unit tests while accumulating a coverage.txt file suitable for shipping to https://codecov.io/. This also adds a badge to README.md: codecov.io

$ make test-cover
docker run --rm -e GO15VENDOREXPERIMENT=1 -v /Users/matt/Projects/src/github.com/deis/builder:/go/src/github.com/deis/builder -w /go/src/github.com/deis/builder quay.io/deis/go-dev:latest test-cover.sh
?       github.com/deis/builder/pkg [no test files]
ok      github.com/deis/builder/pkg/cleaner 5.017s  coverage: 84.6% of statements
?       github.com/deis/builder/pkg/conf    [no test files]
ok      github.com/deis/builder/pkg/controller  0.020s  coverage: 27.3% of statements
ok      github.com/deis/builder/pkg/env 0.009s  coverage: 100.0% of statements
ok      github.com/deis/builder/pkg/git 0.024s  coverage: 4.9% of statements
ok      github.com/deis/builder/pkg/gitreceive  0.078s  coverage: 20.4% of statements
ok      github.com/deis/builder/pkg/healthsrv   0.027s  coverage: 85.5% of statements
?       github.com/deis/builder/pkg/k8s [no test files]
ok      github.com/deis/builder/pkg/sshd    1.699s  coverage: 65.6% of statements
ok      github.com/deis/builder/pkg/storage 0.016s  coverage: 51.6% of statements
?       github.com/deis/builder/pkg/sys [no test files]
?       github.com/deis/builder [no test files]
$ ls -alh coverage.txt 
-rw-r--r--  1 matt  staff    28K Apr 24 12:31 coverage.txt
$ head coverage.txt 

mode: atomic
github.com/deis/builder/pkg/cleaner/cleaner.go:23.74,25.16 2 1
github.com/deis/builder/pkg/cleaner/cleaner.go:28.2,28.6 1 1
github.com/deis/builder/pkg/cleaner/cleaner.go:25.16,27.3 1 0
github.com/deis/builder/pkg/cleaner/cleaner.go:28.6,29.10 1 87915699
github.com/deis/builder/pkg/cleaner/cleaner.go:30.3,31.11 1 87916906
github.com/deis/builder/pkg/cleaner/cleaner.go:34.4,34.31 1 7
github.com/deis/builder/pkg/cleaner/cleaner.go:31.11,32.10 1 87918462
github.com/deis/builder/pkg/cleaner/cleaner.go:34.31,35.32 1 3
...

TODO:

deis/docker-go-dev#34

Testing Instructions

Please provide a detailed list for how to test the changes in this PR.

  1. Build a local deis/go-dev:latest image from the PR referenced above
  2. Check out this PR and run make test-cover

Anticipated results:

  1. There is a coverage.txt file present containing code analysis data
  2. The coverage.txt file is not in version control or marked as needing to be added

Next steps:

  1. Help me figure out how to upload coverage.txt to codecov.io
  2. Make a bunch of PRs just like this until all deis/* Go projects have code coverage reporting :boom:

    Pull Request Hygiene TODOs

Please make sure the below checklist is complete.

mboersma commented 8 years ago

AFAICT, this is actually working correctly, but codecov.io has no baseline coverage report against which to compare these results. Chicken-and-egg thing.

I noticed that if there are no tests in a given go package, it doesn't get included. I think we would prefer for it to show "0% coverage," which might be accomplished by fabricating an entry in coverage.txt.

I'm curious if anyone who has worked with codecov.io has input on this. I'd like to sort it out and do something similar for all Deis Workflow go packages.

codecov-io commented 8 years ago

Current coverage is 41.90%

No coverage report found for master at 43a66c9.

Powered by Codecov. Last updated by 43a66c9...4589558

arschles commented 8 years ago

@mboersma I restarted the e2e build. hopefully it passes 😄