Skip to content

Commit

Permalink
Add code coverage and publish it in azure pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
gdiazlo committed Mar 14, 2019
1 parent 520a84b commit 180f444
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,32 @@ steps:
cd ..
workingDirectory: '$(modulePath)'
displayName: 'Build rocksdb'


- script |
go get github.com/jstemmer/go-junit-report
go get github.com/axw/gocov/gocov
go get github.com/AlekSi/gocov-xml
go get -u gopkg.in/matm/v1/gocov-html

- script: |
go version
go mod download
go test -v -coverprofile=coverage.txt -covermode=atomic ./...
go test -v -coverprofile=coverage.txt -covermode=atomic ./... 2>&1 | go-junit-report > report.xml
go vet -composites=false ./...
gocov convert coverage.txt > coverage.json
gocov-xml < coverage.json > coverage.xml
mkdir coverage
gocov-html < coverage.json > coverage/index.html
workingDirectory: '$(modulePath)'
displayName: 'Get dependencies, then build'

- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: $(System.DefaultWorkingDirectory)/**/report.xml

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/**/coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/**/coverage

0 comments on commit 180f444

Please sign in to comment.