jainpiyush19 / godacov

Command-line tool to publish go test coverage reports to Codacy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

godacov FOSSA Status Security Rating

godacov is a command-line tool to publish test coverage reports generated with go test -coverprofile=<filename> to Codacy.

How to use

Install godacov using go get

$ go get github.com/schrej/godacov

Retrieve a project token from codacy from Your Project > Settings > Integrations > Project API.

Run your tests and generate the coverage report.


go test -coverprofile=coverage.out

If you have multiple Packages, have a look at haya14busa/goverage. As a shortcut, this should work:

go get -u github.com/haya14busa/goverage
goverage -v -coverprofile=coverage.out ./...

Finally publish the results to Codacy using


godacov -t <project token> -r ./coverage.out -c <current commit id>

Travis CI

If you are using Travis CI you should add your project token as a secret environment variable, then run the following command in your script. Remember that you have to append -coverprofile=coverage.out to your test command.

godacov -t $CODACY_TOKEN -r ./coverage.out -c $TRAVIS_COMMIT

CLI Usage

Usage:
  godacov [flags]

Flags:
  -i, --allow-insecure    Allow insecure connection to base URL
  -a, --api-base string   The base URL of the codacy API server to use (default "https://api.codacy.com")
  -c, --commit string     The hash of the commit to provide coverage for
  -h, --help              help for godacov
  -r, --report string     coverage report file generated by 'go test'
  -t, --token string      Codacy project token

License

FOSSA Status

About

Command-line tool to publish go test coverage reports to Codacy

License:Apache License 2.0


Languages

Language:Go 100.0%