120 строки
3.8 KiB
YAML
120 строки
3.8 KiB
YAML
# 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()
|