forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
119 lines (102 loc) · 3.76 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# This builds only track 1 SDKs. See eng\pipelines\templates\steps\build.yml for track 2.
trigger:
paths:
exclude:
- sdk/
- eng/tools/
- eng/config.json
pr:
paths:
exclude:
- sdk/
- eng/tools/
- eng/config.json
jobs:
- job: Build_Test
strategy:
matrix:
Linux_Go116:
pool.name: azsdk-pool-mms-ubuntu-2004-general
go.version: '1.16.7'
Linux_Go117:
pool.name: azsdk-pool-mms-ubuntu-2004-general
go.version: '1.17'
pool:
name: $(pool.name)
variables:
GOPATH: '$(system.defaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/$(build.repository.name)'
GO111MODULE: 'off'
IGNORE_BREAKING_CHANGES: true
go.list.filter: 'profiles services storage'
go.test.filter: '-path ./vendor -prune -o -path ./sdk -prune -o -path ./eng -prune'
steps:
- task: GoTool@0
inputs:
version: '$(go.version)'
displayName: "Select Go Version"
- script: |
set -e
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s dotglob extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
echo '##vso[task.prependpath]$(GOPATH)/bin'
displayName: 'Create Go Workspace'
- script: |
set -e
go version
curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure -v
go get -u golang.org/x/lint/golint
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: |
for dd in $(go.list.filter); do
cd $(sdkPath)/$dd
go vet -v ./...
done
workingDirectory: '$(sdkPath)'
displayName: 'Vet'
- script: |
for dd in $(go.list.filter); do
cd $(sdkPath)/$dd
go build -v ./...
done
workingDirectory: '$(sdkPath)'
displayName: 'Build'
- script: go test $(dirname $(find . $(go.test.filter) -name '*_test.go' -print) | sort -u)
workingDirectory: '$(sdkPath)'
displayName: 'Run Tests'
- template: /eng/common/pipelines/templates/steps/verify-links.yml
parameters:
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
Urls: ($(sdkPath)/eng/common/scripts/get-markdown-files-from-changed-files.ps1)
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
Urls: $(Get-ChildItem -Path '$(sdkPath)/*.md' -Recurse | Where {$_.FullName -notlike "*/vendor/*" -and $_.FullName -notlike "*/sdk/*"})
Directory: ''
ScriptDirectory: '$(sdkPath)/eng/common/scripts'
WorkingDirectory: '$(sdkPath)'
- script: go run ./eng/tools/apidiff/main.go packages ./services FETCH_HEAD~1 FETCH_HEAD --copyrepo --breakingchanges || $IGNORE_BREAKING_CHANGES
workingDirectory: '$(sdkPath)'
displayName: 'Display Breaking Changes'
- script: go run ./eng/tools/pkgchk/main.go ./services --exceptions ./eng/tools/pkgchk/exceptions.txt
workingDirectory: '$(sdkPath)'
displayName: 'Verify Package Directory'
- script: grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2
workingDirectory: '$(sdkPath)'
displayName: 'Copyright Header Check'
failOnStderr: true
condition: succeededOrFailed()
- script: gofmt -s -l -d $(find . -path ./vendor -prune -o -name '*.go' -print) >&2
workingDirectory: '$(sdkPath)'
displayName: 'Format Check'
failOnStderr: true
condition: and(succeededOrFailed(), startsWith(variables['go.version'], '1.16'))
- script: |
golint ./storage/... >&2
workingDirectory: '$(sdkPath)'
displayName: 'Linter Check'
failOnStderr: true
condition: succeededOrFailed()