forked from team-rocos/rosgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
72 lines (63 loc) · 2.15 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
trigger:
branches:
include:
- '*'
paths:
exclude:
- README.md
jobs:
- job: Build
pool:
vmImage: 'ubuntu-20.04'
variables:
- name: GOPATH
value: '$(Agent.TempDirectory)/gopath'
- name: GOBIN
value: '$(GOPATH)/bin'
steps:
- task: GoTool@0
displayName: 'Configure Go 1.16.3'
inputs:
version: '1.16.3'
- script: |
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
echo '##vso[task.prependpath]$(GOPATH)/bin'
GITHUBTOKEN=$(githubToken)
git config --global url."https://${GITHUBTOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
displayName: 'Set up the Go workspace'
- task: Go@0
displayName: 'Build project'
inputs:
command: 'build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- script: |
echo "gobin: $GOBIN"
echo "gopath: $GOPATH"
echo "goroot: $GOROOT"
echo "path: $PATH"
go get -u github.com/axw/gocov/gocov
go get -u github.com/AlekSi/gocov-xml
go get -u github.com/jstemmer/go-junit-report
go mod tidy
go test -v -coverprofile=coverage.txt -covermode count ./ros ./libgengo ./gengo 2>&1 | go-junit-report > report.xml
if [ -f coverage.txt ]; then
gocov convert coverage.txt > coverage.json
gocov-xml < coverage.json > coverage.xml
fi
displayName: 'Run unit test'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: 'report.xml'
searchFolder: '$(System.DefaultWorkingDirectory)'
failTaskOnFailedTests: true
condition: always()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
pathToSources: '$(System.DefaultWorkingDirectory)'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
failIfCoverageEmpty: true
condition: always()