-
Notifications
You must be signed in to change notification settings - Fork 25
/
azure-pipelines.yml
96 lines (82 loc) · 2.84 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
variables:
GOPATH: '$(system.defaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/$(build.repository.name)'
GO111MODULE: 'on'
jobs:
- job: 'azureamqpcommongo'
displayName: 'Run azure-amqp-common-go CI Checks'
strategy:
matrix:
Linux_Go118:
vm.image: 'ubuntu-20.04'
go.version: '1.18.8'
Linux_Go119:
vm.image: 'ubuntu-20.04'
go.version: '1.19.3'
pool:
vmImage: '$(vm.image)'
steps:
- task: GoTool@0
inputs:
version: '$(go.version)'
displayName: "Select Go Version"
- script: |
set -e
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOPATH)/bin'
go version
displayName: 'Create Go Workspace'
- script: |
set -e
go install github.com/jstemmer/[email protected]
go install github.com/axw/gocov/[email protected]
go install github.com/AlekSi/[email protected]
go install github.com/matm/[email protected]
go install github.com/fzipp/gocyclo/cmd/[email protected]
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: |
go build -v ./...
workingDirectory: '$(sdkPath)'
displayName: 'Build'
- script: |
go vet ./...
workingDirectory: '$(sdkPath)'
displayName: 'Vet'
- script: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
golangci-lint --version
golangci-lint run
workingDirectory: '$(sdkPath)'
displayName: 'Lint'
- script: |
gocyclo -over 19 .
workingDirectory: '$(sdkPath)'
displayName: 'Cyclo'
- script: |
set -e
go test -race -v -coverprofile=coverage.txt -covermode atomic ./... 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: |
gofmt -s -l -w . >&2
workingDirectory: '$(sdkPath)'
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