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
|
# This step is designed to work against linux only
parameters:
ServiceDirectory: ''
LintVersion: ''
NonShipping: false
LicenseCheck: true
steps:
- task: Powershell@2
displayName: 'Dependency Check'
env:
GO111MODULE: 'on'
inputs:
targetType: filePath
pwsh: true
filePath: eng/scripts/Invoke-DependencyCheck.ps1
arguments: 'sdk/${{ parameters.ServiceDirectory }}'
- script: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${{parameters.LintVersion}}
golangci-lint --version
displayName: 'Install GoLintCLI and dependencies.'
workingDirectory: $(System.DefaultWorkingDirectory)
retryCountOnTaskFailure: 3
- pwsh: |
$modDirs = ./eng/scripts/get_module_dirs.ps1 '${{ parameters.ServiceDirectory }}'
foreach ($md in $modDirs) {
pushd $md
Write-Host "##[command]Executing golangci-lint run -c $(System.DefaultWorkingDirectory)/eng/.golangci.yml in $md"
golangci-lint run -c $(System.DefaultWorkingDirectory)/eng/.golangci.yml
}
displayName: 'Lint'
failOnStderr: false
workingDirectory: $(System.DefaultWorkingDirectory)
- pwsh: |
$modDirs = ./eng/scripts/get_module_dirs.ps1 '${{ parameters.ServiceDirectory }}'
foreach ($md in $modDirs) {
if (-Not $md -Match "/arm") {
Get-ChildItem $md/doc.go
}
}
displayName: 'Verify doc.go'
workingDirectory: $(System.DefaultWorkingDirectory)
- script: |
echo scanning copyright headers in $(pwd)
grep -L -r --include \*.go -P "Copyright (\d{4}|\(c\)) Microsoft" . | tee >&2
displayName: 'Copyright Header Check'
condition: succeededOrFailed()
failOnStderr: true
workingDirectory: 'sdk/${{parameters.ServiceDirectory}}'
- ${{ if eq(parameters.LicenseCheck, 'true') }}:
- pwsh: |
Write-Host "ensuring $(pwd)/LICENSE.txt file exists"
if (Test-Path LICENSE.txt) {
$patternMatches = Get-Content ./LICENSE.txt | Select-String -Pattern 'Copyright (\d{4}|\(c\)) Microsoft'
if ($patternMatches.Length -eq 0) {
Write-Host "LICENSE.txt file is invalid"
exit 1
}
} else {
Write-Host "Could not find a LICENSE.txt file"
exit 1
}
displayName: 'LICENSE.txt Check'
condition: succeededOrFailed()
workingDirectory: 'sdk/${{parameters.ServiceDirectory}}'
- script: |
echo Check source file formatting in $(pwd)
gofmt -s -l -d . | tee >&2
displayName: 'Format Check'
condition: succeededOrFailed()
failOnStderr: true
workingDirectory: 'sdk/${{parameters.ServiceDirectory}}'
- template: /eng/common/pipelines/templates/steps/verify-links.yml
parameters:
Directory: sdk/${{ parameters.ServiceDirectory }}
CheckLinkGuidance: $true
- script: |
go run . --directory '$(System.DefaultWorkingDirectory)/sdk/${{parameters.ServiceDirectory}}'
displayName: 'Validate Documentation'
condition: succeededOrFailed()
workingDirectory: 'eng/tools/doccheck'
- template: /eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml
- ${{if eq(parameters.NonShipping, 'false')}}:
- template: /eng/common/pipelines/templates/steps/verify-changelog.yml
parameters:
PackageName: 'sdk/${{parameters.ServiceDirectory}}'
ForRelease: false
- task: PowerShell@2
displayName: 'Run Nightly SmokeTests'
inputs:
targetType: 'filePath'
filePath: ./eng/scripts/Smoke_Tests_Nightly.ps1
pwsh: true
arguments: '${{ parameters.ServiceDirectory }}'
|