New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit test coverage info to code climate and codecov #1705

Merged
merged 16 commits into from Feb 6, 2019

Conversation

3 participants
@jim
Copy link
Contributor

jim commented Feb 6, 2019

Description

This PR adds a new job to our CircleCI config that runs the Go unit tests and submits the coverage information to CodeClimate and codecov.

I'd like to merge this in a let it run for a little while to see if any of the tools on these services prove to be useful.

Reviewer Notes

The cc-test-reporter program is a little picky about where it expects things to be, and in order to get everything working some commands need to be run from a directory above the main repo. I think this is harmless as it only affects this job. codecov was a lot easier to configure, FWIW.

I haven't gotten into client-side test coverage, but I will look into that next.

@jim jim changed the title WIP - Submit test coverage info to code climate Submit test coverage info to code climate and codecov Feb 6, 2019

@jim jim requested review from chrisgilmerproj , tinyels and akostibas Feb 6, 2019

Makefile Outdated
@@ -207,14 +207,14 @@ server_test_all: server_deps server_generate db_dev_reset db_dev_migrate
# Like server_test but runs extended tests that may hit external services.
go test -p 1 -count 1 $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/)

server_test_coverage: server_deps server_generate db_dev_reset db_dev_migrate
server_test_coverage: server_deps server_generate db_test_reset db_test_migrate

This comment has been minimized.

@jim

jim Feb 6, 2019

Author Contributor

This change was needed to get make server_test_coverage to run.

# Don't run tests in /cmd or /pkg/gen
# Use -test.parallel 1 to test packages serially and avoid database collisions
# Disable test caching with `-count 1` - caching was masking local test failures
# Add coverage tracker via go cover
# Then open coverage tracker in HTML
go test -coverprofile=coverage.out -p 1 -count 1 $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/)
go tool cover -html=coverage.out
go test -coverprofile=coverage.out -covermode=count -p 1 -count 1 -short $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/)

This comment has been minimized.

@jim

jim Feb 6, 2019

Author Contributor

-covermode=count counts how many times each line is run, not only if it was run. Read more.

This comment has been minimized.

@chrisgilmerproj

chrisgilmerproj Feb 6, 2019

Contributor

Do we still want to remove the comment block? The first couple lines seem relevant still.

This comment has been minimized.

@jim

jim Feb 6, 2019

Author Contributor

I put it back!

This comment has been minimized.

@chrisgilmerproj

chrisgilmerproj Feb 6, 2019

Contributor

Thanks! 💯

Makefile Outdated
go test -coverprofile=coverage.out -p 1 -count 1 $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/)
go tool cover -html=coverage.out
go test -coverprofile=coverage.out -covermode=count -p 1 -count 1 -short $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/)
# go tool cover -html=coverage.out

This comment has been minimized.

@jim

jim Feb 6, 2019

Author Contributor

This is useful for developers, so I can move it to another make target.

This comment has been minimized.

@chrisgilmerproj
@chrisgilmerproj
Copy link
Contributor

chrisgilmerproj left a comment

💯

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Feb 6, 2019

Codecov Report

❗️ No coverage uploaded for pull request base (master@703dbd2). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1705   +/-   ##
=========================================
  Coverage          ?   46.94%           
=========================================
  Files             ?      406           
  Lines             ?    16932           
  Branches          ?     1601           
=========================================
  Hits              ?     7949           
  Misses            ?     8274           
  Partials          ?      709
Flag Coverage Δ
#go 56.39% <ø> (?)
#javascript 32.92% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 703dbd2...edac5f1. Read the comment docs.

@jim jim merged commit 052a7d9 into master Feb 6, 2019

19 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
ci/circleci: acceptance_tests_experimental Your tests passed on CircleCI!
Details
ci/circleci: acceptance_tests_local Your tests passed on CircleCI!
Details
ci/circleci: acceptance_tests_staging Your tests passed on CircleCI!
Details
ci/circleci: build_app Your tests passed on CircleCI!
Details
ci/circleci: build_migrations Your tests passed on CircleCI!
Details
ci/circleci: build_tools Your tests passed on CircleCI!
Details
ci/circleci: client_test Your tests passed on CircleCI!
Details
ci/circleci: client_test_coverage Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_mymove Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_office Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_tsp Your tests passed on CircleCI!
Details
ci/circleci: pre_deps_golang Your tests passed on CircleCI!
Details
ci/circleci: pre_deps_yarn Your tests passed on CircleCI!
Details
ci/circleci: pre_test Your tests passed on CircleCI!
Details
ci/circleci: server_test Your tests passed on CircleCI!
Details
ci/circleci: server_test_coverage Your tests passed on CircleCI!
Details
codecov/patch Coverage not affected.
Details
codecov/project No report found to compare against
Details

@jim jim deleted the jb-codeclimate branch Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment