github.com/vlal/goveralls@v0.0.2-0.20171114042957-b71a1e4855f8/README.md (about) 1 goveralls 2 ========= 3 4 [Go](http://golang.org) integration for [Coveralls.io](http://coveralls.io) 5 continuous code coverage tracking system. 6 7 # Installation 8 9 `goveralls` requires a working Go installation (Go-1.2 or higher). 10 11 ```bash 12 $ go get github.com/mattn/goveralls 13 ``` 14 15 16 # Usage 17 18 First you will need an API token. It is found at the bottom of your 19 repository's page when you are logged in to Coveralls.io. Each repo has its 20 own token. 21 22 ```bash 23 $ cd $GOPATH/src/github.com/yourusername/yourpackage 24 $ goveralls -repotoken your_repos_coveralls_token 25 ``` 26 27 You can set the environment variable `$COVERALLS_TOKEN` to your token so you do 28 not have to specify it at each invocation. 29 30 # Continuous Integration 31 32 There is no need to run `go test` separately, as `goveralls` runs the entire 33 test suite. 34 35 ## Travis CI 36 37 ### GitHub Integration 38 39 Enable Travis-CI on your github repository settings. 40 41 For a **public** github repository put below's `.travis.yml`. 42 43 ```yml 44 language: go 45 sudo: false 46 go: 47 - tip 48 before_install: 49 - go get github.com/mattn/goveralls 50 script: 51 - $GOPATH/bin/goveralls -service=travis-ci 52 ``` 53 54 For a **public** github repository, it is not necessary to define your repository key (`COVERALLS_TOKEN`). 55 56 For a **private** github repository put below's `.travis.yml`. If you use **travis pro**, you need to specify `-service=travis-pro` instead of `-service=travis-ci`. 57 58 ```yml 59 language: go 60 sudo: false 61 go: 62 - tip 63 before_install: 64 - go get github.com/mattn/goveralls 65 script: 66 - $GOPATH/bin/goveralls -service=travis-pro 67 ``` 68 69 Store your Coveralls API token in `Environment variables`. 70 71 ``` 72 COVERALLS_TOKEN = your_token_goes_here 73 ``` 74 75 or you can store token using [travis encryption keys](https://docs.travis-ci.com/user/encryption-keys/). Note that this is the token provided in the page for that specific repository on Coveralls. This is *not* one that was created from the "Personal API Tokens" area under your Coveralls account settings. 76 77 ``` 78 $ gem install travis 79 $ travis encrypt COVERALLS_TOKEN=your_token_goes_here --add env.global 80 ``` 81 82 travis will add `env` block as following example: 83 84 ```yml 85 env: 86 global: 87 secure: xxxxxxxxxxxxx 88 ``` 89 90 ### For others: 91 92 ``` 93 $ go get github.com/mattn/goveralls 94 $ go test -covermode=count -coverprofile=profile.cov 95 $ goveralls -coverprofile=profile.cov -service=travis-ci 96 ``` 97 98 ## Drone.io 99 100 Store your Coveralls API token in `Environment Variables`: 101 102 ``` 103 COVERALLS_TOKEN=your_token_goes_here 104 ``` 105 106 Replace the `go test` line in your `Commands` with these lines: 107 108 ``` 109 $ go get github.com/mattn/goveralls 110 $ goveralls -service drone.io 111 ``` 112 113 `goveralls` automatically use the environment variable `COVERALLS_TOKEN` as the 114 default value for `-repotoken`. 115 116 You can use the `-v` flag to see verbose output from the test suite: 117 118 ``` 119 $ goveralls -v -service drone.io 120 ``` 121 122 ## CircleCI 123 124 Store your Coveralls API token as an [Environment Variable](https://circleci.com/docs/environment-variables). 125 126 In your `circle.yml` add the following commands under the `test` section. 127 128 ```yml 129 test: 130 pre: 131 - go get github.com/mattn/goveralls 132 override: 133 - go test -v -cover -race -coverprofile=/home/ubuntu/coverage.out 134 post: 135 - /home/ubuntu/.go_workspace/bin/goveralls -coverprofile=/home/ubuntu/coverage.out -service=circle-ci -repotoken=$COVERALLS_TOKEN 136 ``` 137 138 For more information, See https://coveralls.zendesk.com/hc/en-us/articles/201342809-Go 139 140 # Authors 141 142 * Yasuhiro Matsumoto (a.k.a. mattn) 143 * haya14busa 144 145 # License 146 147 under the MIT License: http://mattn.mit-license.org/2016