...

Text file src/github.com/Azure/azure-sdk-for-go/azure-pipelines.yml

Documentation: github.com/Azure/azure-sdk-for-go

     1# This builds only track 1 SDKs. See eng\pipelines\templates\steps\build.yml for track 2.
     2
     3trigger:
     4  paths:
     5    exclude:
     6    - sdk/
     7    - eng/tools/
     8    - eng/config.json
     9
    10pr:
    11  paths:
    12    exclude:
    13    - sdk/
    14    - eng/tools/
    15    - eng/config.json
    16
    17jobs:
    18  - job: Build_Test
    19    strategy:
    20      matrix:
    21        Linux_Go117:
    22          pool.name: azsdk-pool-mms-ubuntu-2004-general
    23          go.version: '1.17.8'
    24        Linux_Go118:
    25          pool.name: azsdk-pool-mms-ubuntu-2004-general
    26          go.version: '1.18.2'
    27
    28    pool:
    29      name: $(pool.name)
    30
    31    variables:
    32      - template: /eng/pipelines/templates/variables/globals.yml
    33      - name: GOPATH
    34        value: '$(system.defaultWorkingDirectory)/work'
    35      - name: sdkPath
    36        value: '$(GOPATH)/src/github.com/$(build.repository.name)'
    37      - name: GO111MODULE
    38        value: 'off'
    39      - name: IGNORE_BREAKING_CHANGES
    40        value: 'true'
    41      - name: go.list.filter
    42        value: 'profiles services storage'
    43      - name: go.test.filter
    44        value: '-path ./vendor -prune -o -path ./sdk -prune -o -path ./eng -prune -o'
    45
    46    steps:
    47    - task: GoTool@0
    48      inputs:
    49        version: '$(go.version)'
    50      displayName: "Select Go Version"
    51
    52    - script: |
    53        set -e
    54        mkdir -p '$(GOPATH)/bin'
    55        mkdir -p '$(sdkPath)'
    56        shopt -s dotglob extglob
    57        mv !(work) '$(sdkPath)'
    58        echo '##vso[task.prependpath]$(GOROOT)/bin'
    59        echo '##vso[task.prependpath]$(GOPATH)/bin'
    60      displayName: 'Create Go Workspace'
    61
    62    - script: |
    63        set -e
    64        go version
    65        curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    66        dep ensure -v
    67        go get -u golang.org/x/lint/golint
    68      workingDirectory: '$(sdkPath)'
    69      displayName: 'Install Dependencies'
    70
    71    - script: |
    72        for dd in $(go.list.filter); do
    73          cd $(sdkPath)/$dd
    74          go vet -v ./...
    75        done
    76      workingDirectory: '$(sdkPath)'
    77      displayName: 'Vet'
    78
    79    - script: |
    80        for dd in $(go.list.filter); do
    81          cd $(sdkPath)/$dd
    82          go build -v ./...
    83        done
    84      workingDirectory: '$(sdkPath)'
    85      displayName: 'Build'
    86
    87    - script: go test $(dirname $(find . $(go.test.filter) -name '*_test.go' -print) | sort -u)
    88      workingDirectory: '$(sdkPath)'
    89      displayName: 'Run Tests'
    90
    91    - template: /eng/common/pipelines/templates/steps/verify-links.yml
    92      parameters:
    93        ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
    94          Urls: ($(sdkPath)/eng/common/scripts/get-markdown-files-from-changed-files.ps1)
    95        ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
    96          Urls: $(Get-ChildItem -Path '$(sdkPath)/*.md' -Recurse | Where {$_.FullName -notlike "*/vendor/*" -and $_.FullName -notlike "*/sdk/*"})
    97        Directory: ''
    98        ScriptDirectory: '$(sdkPath)/eng/common/scripts'
    99        WorkingDirectory: '$(sdkPath)'
   100
   101    - script: go run ./eng/tools/apidiff/main.go packages ./services FETCH_HEAD~1 FETCH_HEAD --copyrepo --breakingchanges || $IGNORE_BREAKING_CHANGES
   102      workingDirectory: '$(sdkPath)'
   103      displayName: 'Display Breaking Changes'
   104
   105    - script: go run ./eng/tools/pkgchk/main.go ./services --exceptions ./eng/tools/pkgchk/exceptions.txt
   106      workingDirectory: '$(sdkPath)'
   107      displayName: 'Verify Package Directory'
   108
   109    - script: grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2
   110      workingDirectory: '$(sdkPath)'
   111      displayName: 'Copyright Header Check'
   112      failOnStderr: true
   113      condition: succeededOrFailed()
   114
   115    - script: |
   116        for dd in $(go.list.filter); do
   117          cd $(sdkPath)/$dd
   118          gofmt -s -l -d $(find . -name '*.go' -print) >&2
   119        done
   120      workingDirectory: '$(sdkPath)'
   121      displayName: 'Format Check'
   122      failOnStderr: true
   123      condition: and(succeededOrFailed(), startsWith(variables['go.version'], '1.16'))
   124
   125    - script: |
   126        golint ./storage/... >&2
   127      workingDirectory: '$(sdkPath)'
   128      displayName: 'Linter Check'
   129      failOnStderr: true
   130      condition: succeededOrFailed()

View as plain text