File: build-test.yml

package info (click to toggle)
golang-github-azure-azure-sdk-for-go 68.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556,256 kB
  • sloc: javascript: 196; sh: 96; makefile: 7
file content (135 lines) | stat: -rw-r--r-- 4,608 bytes parent folder | download
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
parameters:
  - name:  ServiceDirectory
    type: string
    default: ''
  - name:  Image
    type: string
    default: ''
  - name:  GoVersion
    type: string
    default: ''
  - name:  TestProxy
    type: boolean
    default: false
  - name: EnvVars
    type: object
    default: {}
  - name: TestRunTime
    type: string
    default: '600s'

steps:
  - task: Powershell@2
    displayName: Build
    env:
      GO111MODULE: 'on'
    inputs:
      targetType: filePath
      pwsh: true
      filePath: eng/scripts/build.ps1
      arguments: -filter '${{ parameters.ServiceDirectory }}'

  - task: Powershell@2
    displayName: Vet
    env:
      GO111MODULE: 'on'
    inputs:
      targetType: filePath
      pwsh: true
      filePath: eng/scripts/build.ps1
      arguments: -vet -skipBuild -filter '${{ parameters.ServiceDirectory }}'

  - pwsh: |
      go install github.com/jstemmer/go-junit-report@v0.9.1
      go install github.com/axw/gocov/gocov@v1.1.0
      go install github.com/AlekSi/gocov-xml@v1.0.0
      go install github.com/matm/gocov-html@v0.0.0-20200509184451-71874e2e203b
    displayName: "Install Coverage and Junit Dependencies"

  - ${{ if eq(parameters.TestProxy, true) }}:
    - template: /eng/common/testproxy/test-proxy-tool.yml

  - task: PowerShell@2
    displayName: 'Run Tests'
    inputs:
      targetType: 'filePath'
      filePath: ./eng/scripts/run_tests.ps1
      arguments: '${{ parameters.ServiceDirectory }} ${{ parameters.TestRunTime }}'
      pwsh: true
    env:
      GO111MODULE: 'on'
      PROXY_CERT: $(Build.SourcesDirectory)/eng/common/testproxy/dotnet-devcert.crt
      ${{ insert }}: ${{ parameters.EnvVars }}

  - task: PowerShell@2
    displayName: 'Build Performance Tests'
    inputs:
      targetType: 'filePath'
      filePath: ./eng/scripts/Build_Perf.ps1
      arguments: '${{ parameters.ServiceDirectory }}'
      pwsh: true

  - ${{ if eq(parameters.TestProxy, true) }}:
    - pwsh: |
        # $(Build.SourcesDirectory)/test-proxy.log is the hardcoded output log location for the test-proxy-tool.yml
        cat $(Build.SourcesDirectory)/test-proxy.log
      displayName: 'Dump Test Proxy logs'
      condition: succeededOrFailed()

  - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
    displayName: 'Generate BOM'
    condition: and(succeededOrFailed(), eq(variables['generate.bom'], 'true'))
    inputs:
      BuildDropPath: $(Build.ArtifactStagingDirectory)

  - task: Powershell@2
    inputs:
      filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
      arguments: >
        -ServiceDirectory ${{parameters.ServiceDirectory}}
        -OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
      pwsh: true
      workingDirectory: $(Pipeline.Workspace)
    displayName: Dump Package properties
    condition: succeeded()

  - template: /eng/common/pipelines/templates/steps/set-default-branch.yml
  
  - task: Powershell@2
    inputs:
      filePath: $(Build.SourcesDirectory)/eng/scripts/Create-ApiReview.ps1
      arguments: >
        -ServiceDirectory ${{parameters.ServiceDirectory}}
        -OutPath $(Build.ArtifactStagingDirectory)
        -ApiviewUri "$(azuresdk-apiview-uri)"
        -ApiKey "$(azuresdk-apiview-apikey)"
        -ApiLabel "Auto Review - $(Build.SourceVersion)"
        -SourceBranch $(Build.SourceBranchName)
        -DefaultBranch $(DefaultBranch)
        -ConfigFileDir $(Build.ArtifactStagingDirectory)/PackageInfo
      pwsh: true
      workingDirectory: $(Pipeline.Workspace)
    displayName: Create API review for Go
    continueOnError: true
    condition: and(succeeded(), ne(variables['Skip.CreateApiReview'], 'true') , ne(variables['Build.Reason'],'PullRequest'), eq(variables['System.TeamProject'], 'internal'))

  - template: /eng/common/pipelines/templates/steps/publish-artifact.yml
    parameters:
      ArtifactPath: '$(Build.ArtifactStagingDirectory)/_manifest'
      ArtifactName: 'manifest'
      CustomCondition: and(succeededOrFailed(), eq(variables['generate.bom'], 'true'))

  - task: PublishTestResults@2
    condition: succeededOrFailed()
    inputs:
      testRunner: JUnit
      testResultsFiles: '$(Build.SourcesDirectory)/sdk/${{parameters.ServiceDirectory}}/report.xml'
      testRunTitle: 'Go ${{ parameters.GoVersion }} on ${{ parameters.Image }}'
      failTaskOnFailedTests: true

  - task: PublishCodeCoverageResults@1
    condition: succeededOrFailed()
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: './coverage.xml'
      additionalCodeCoverageFiles: './coverage.html'