Skip to content

Commit

Permalink
add test results and code coverage to track2 CI (#6980)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT committed Jan 16, 2020
1 parent 7a7120f commit fa96a37
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion sdk/ci.yml
Expand Up @@ -37,6 +37,10 @@ jobs:
- script: |
set -e
go version
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 github.com/matm/gocov-html
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: go vet $(go list ./sdk/...)
Expand All @@ -45,7 +49,11 @@ jobs:
- script: go build -v $(go list ./sdk/...)
workingDirectory: '$(sdkPath)'
displayName: 'Build'
- script: go test ./sdk/...
- script: |
go test -race -v -coverprofile=coverage.txt -covermode atomic ./sdk/... 2>&1 | go-junit-report > report.xml
gocov convert coverage.txt > coverage.json
gocov-xml < coverage.json > coverage.xml
gocov-html < coverage.json > coverage.html
workingDirectory: '$(sdkPath)'
displayName: 'Run Tests'
- script: grep -L -r --include \*.go -P "Copyright (\d{4}|\(c\)) Microsoft" ./sdk | tee >&2
Expand All @@ -58,3 +66,15 @@ jobs:
displayName: 'Format Check'
failOnStderr: true
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: $(sdkPath)/report.xml
failTaskOnFailedTests: true

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(sdkPath)/coverage.xml
additionalCodeCoverageFiles: $(sdkPath)/coverage.html

0 comments on commit fa96a37

Please sign in to comment.