This is a example repository to show how to generate and upload coverage report to Covergates for Go
.
To get started, please download the prebuilt binary from release page.
Unzip the binaries to your /path/to/bin
.
Please fork the repository at first by click the Fork on the top-right of the repository page.
After that, clone the repository to your workspace with:
git clone https://github.com/<your account>/go-example.git
cd go-example
It is assume that you have installed Go
. If you haven't installed it, refer to installation guide.
Run go test
:
go test -coverprofile=coverage.out .
You will see below standard outputs:
ok go-example 0.001s coverage: 50.0% of statements
The coverage report is also generated, which is coverage.out
with below content:
mode: set
go-example/main.go:5.24,7.2 1 1
go-example/main.go:9.13,11.2 1 0
Before uploading report, you need to activate repository on Covergates.
Visit https://covergates.com/repo and click ACTIVATE right to go-example
repository.
💁 You require login Covergate with your GitHub Account to continue
Visit repository setting page https://covergates.com/report/github/your-account/go-example/setting
You could find the Report ID which is used to upload report as below image shown:
Update the filter setting as below and press SAVE
Go back to your go-example
workspace, run:
export REPORT_ID="your Report ID"
covergates upload --type go ./coverage.out
You should see below message is uploading success.
2020/08/09 22:44:47 upload commit 5b9f6246e7afe2d86c52d5673e90a1d6e172022c, go
2020/08/09 22:44:48 ok
Visit https://covergates.com/report/github/your-account/go-example to see the report.