github.com/smithoss/goveralls@v0.0.0-20190920204720-1fdbb5119c20/README.md (about) 1 goveralls 2 ========= 3 4 Accreditation: This repository was cloned from https://github.com/mattn/goveralls. 5 It is not forked because we do not intend to submit upstream patches. The upstream 6 source is relatively inactive and we want to be able to provide a more rapid response. 7 8 It continues to be licensed under the MIT license. 9 10 [Go](http://golang.org) integration for [Coveralls.io](http://coveralls.io) 11 continuous code coverage tracking system. 12 13 # Installation 14 15 `goveralls` requires a working Go installation (Go-1.2 or higher). 16 17 ```bash 18 $ go get github.com/smithoss/goveralls 19 ``` 20 21 22 # Usage 23 24 First you will need an API token. It is found at the bottom of your 25 repository's page when you are logged in to Coveralls.io. Each repo has its 26 own token. 27 28 ```bash 29 $ cd $GOPATH/src/github.com/yourusername/yourpackage 30 $ goveralls -repotoken your_repos_coveralls_token 31 ``` 32 33 You can set the environment variable `$COVERALLS_TOKEN` to your token so you do 34 not have to specify it at each invocation. 35 36 37 You can also run this reporter for multiple passes with the flag `-parallel` or 38 by setting the environment variable `COVERALLS_PARALLEL=true` (see [coveralls 39 docs](https://docs.coveralls.io/parallel-build-webhook) for more details. 40 41 42 # Continuous Integration 43 44 There is no need to run `go test` separately, as `goveralls` runs the entire 45 test suite. 46 47 ## Travis CI 48 49 ### GitHub Integration 50 51 Enable Travis-CI on your github repository settings. 52 53 For a **public** github repository put below's `.travis.yml`. 54 55 ```yml 56 language: go 57 sudo: false 58 go: 59 - tip 60 before_install: 61 - go get github.com/smithoss/goveralls 62 script: 63 - $GOPATH/bin/goveralls -service=travis-ci 64 ``` 65 66 For a **public** github repository, it is not necessary to define your repository key (`COVERALLS_TOKEN`). 67 68 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`. 69 70 ```yml 71 language: go 72 sudo: false 73 go: 74 - tip 75 before_install: 76 - go get github.com/smithoss/goveralls 77 script: 78 - $GOPATH/bin/goveralls -service=travis-pro 79 ``` 80 81 Store your Coveralls API token in `Environment variables`. 82 83 ``` 84 COVERALLS_TOKEN = your_token_goes_here 85 ``` 86 87 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. 88 89 ``` 90 $ gem install travis 91 $ travis encrypt COVERALLS_TOKEN=your_token_goes_here --add env.global 92 ``` 93 94 travis will add `env` block as following example: 95 96 ```yml 97 env: 98 global: 99 secure: xxxxxxxxxxxxx 100 ``` 101 102 ### For others: 103 104 ``` 105 $ go get github.com/smithoss/goveralls 106 $ go test -covermode=count -coverprofile=profile.cov 107 $ goveralls -coverprofile=profile.cov -service=travis-ci 108 ``` 109 110 ## Drone.io 111 112 Store your Coveralls API token in `Environment Variables`: 113 114 ``` 115 COVERALLS_TOKEN=your_token_goes_here 116 ``` 117 118 Replace the `go test` line in your `Commands` with these lines: 119 120 ``` 121 $ go get github.com/smithoss/goveralls 122 $ goveralls -service drone.io 123 ``` 124 125 `goveralls` automatically use the environment variable `COVERALLS_TOKEN` as the 126 default value for `-repotoken`. 127 128 You can use the `-v` flag to see verbose output from the test suite: 129 130 ``` 131 $ goveralls -v -service drone.io 132 ``` 133 134 ## CircleCI 135 136 Store your Coveralls API token as an [Environment Variable](https://circleci.com/docs/environment-variables). 137 138 In your `circle.yml` add the following commands under the `test` section. 139 140 ```yml 141 test: 142 pre: 143 - go get github.com/smithoss/goveralls 144 override: 145 - go test -v -cover -race -coverprofile=/home/ubuntu/coverage.out 146 post: 147 - /home/ubuntu/.go_workspace/bin/goveralls -coverprofile=/home/ubuntu/coverage.out -service=circle-ci -repotoken=$COVERALLS_TOKEN 148 ``` 149 150 For more information, See https://coveralls.zendesk.com/hc/en-us/articles/201342809-Go 151 152 ## Semaphore 153 154 Store your Coveralls API token in `Environment Variables`: 155 156 ``` 157 COVERALLS_TOKEN=your_token_goes_here 158 ``` 159 160 More instructions on how to do this can be found in the [Semaphore documentation](https://semaphoreci.com/docs/exporting-environment-variables.html). 161 162 Replace the `go test` line in your `Commands` with these lines: 163 164 ``` 165 $ go get github.com/smithoss/goveralls 166 $ goveralls -service semaphore 167 ``` 168 169 `goveralls` automatically use the environment variable `COVERALLS_TOKEN` as the 170 default value for `-repotoken`. 171 172 You can use the `-v` flag to see verbose output from the test suite: 173 174 ``` 175 $ goveralls -v -service semaphore 176 ``` 177 178 ## Coveralls Enterprise 179 180 If you are using Coveralls Enterprise and have a self-signed certificate, you need to skip certificate verification: 181 182 ```shell 183 $ goveralls -insecure 184 ``` 185