зеркало из https://github.com/Azure/go-amqp.git
106 строки
3.4 KiB
YAML
106 строки
3.4 KiB
YAML
variables:
|
|
GO111MODULE: 'on'
|
|
AMQP_BROKER_ADDR: 'amqp://127.0.0.1:25672'
|
|
|
|
jobs:
|
|
- job: 'goamqp'
|
|
displayName: 'Run go-amqp CI Checks'
|
|
|
|
strategy:
|
|
matrix:
|
|
Linux_Go118:
|
|
pool.name: 'azsdk-pool-mms-ubuntu-2004-general'
|
|
vm.image: 'ubuntu-20.04'
|
|
go.version: '1.18.10'
|
|
Linux_Go122:
|
|
pool.name: 'azsdk-pool-mms-ubuntu-2004-general'
|
|
vm.image: 'ubuntu-20.04'
|
|
go.version: '1.22.7'
|
|
Linux_Go123:
|
|
pool.name: 'azsdk-pool-mms-ubuntu-2004-general'
|
|
vm.image: 'ubuntu-20.04'
|
|
go.version: '1.23.1'
|
|
|
|
pool:
|
|
name: '$(pool.name)'
|
|
vmImage: '$(vm.image)'
|
|
|
|
steps:
|
|
- task: GoTool@0
|
|
inputs:
|
|
version: '$(go.version)'
|
|
displayName: "Select Go Version"
|
|
|
|
- script: |
|
|
set -e
|
|
export gopathbin=$(go env GOPATH)/bin
|
|
echo "##vso[task.prependpath]$gopathbin"
|
|
go install github.com/jstemmer/go-junit-report/v2@v2.1.0
|
|
go install github.com/axw/gocov/gocov@v1.1.0
|
|
go install github.com/AlekSi/gocov-xml@v1.1.0
|
|
go install github.com/matm/gocov-html/cmd/gocov-html@v1.4.0
|
|
displayName: 'Install Dependencies'
|
|
|
|
- script: |
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
|
|
golangci-lint --version
|
|
golangci-lint run
|
|
displayName: 'Install and Run GoLintCLI.'
|
|
|
|
- script: |
|
|
go build -v ./...
|
|
displayName: 'Build'
|
|
|
|
- script: |
|
|
go vet ./...
|
|
displayName: 'Vet'
|
|
|
|
- task: UseDotNet@2
|
|
displayName: 'Use .NET sdk'
|
|
inputs:
|
|
packageType: sdk
|
|
version: 6.0.x
|
|
installationPath: $(Agent.ToolsDirectory)/dotnet
|
|
|
|
- script: |
|
|
git clone https://github.com/Azure/azure-amqp $(Pipeline.Workspace)/azure-amqp
|
|
git checkout v2.6.5
|
|
pushd $(Pipeline.Workspace)/azure-amqp/test/TestAmqpBroker
|
|
dotnet restore
|
|
dotnet build
|
|
chmod +x $(Pipeline.Workspace)/azure-amqp/bin/Debug/TestAmqpBroker/net462/TestAmqpBroker.exe
|
|
displayName: 'Clone and Build Broker'
|
|
|
|
- script: |
|
|
set -e
|
|
export TEST_CORPUS=1
|
|
echo '##[command]Starting broker at $(AMQP_BROKER_ADDR)'
|
|
$(Pipeline.Workspace)/azure-amqp/bin/Debug/TestAmqpBroker/net462/TestAmqpBroker.exe $AMQP_BROKER_ADDR /headless &
|
|
brokerPID=$!
|
|
echo '##[section]Starting tests'
|
|
go test -race -v -coverprofile=coverage.txt -covermode atomic ./... 2>&1 | tee gotestoutput.log
|
|
go-junit-report < gotestoutput.log > report.xml
|
|
kill $brokerPID
|
|
gocov convert coverage.txt > coverage.json
|
|
gocov-xml < coverage.json > coverage.xml
|
|
gocov-html < coverage.json > coverage.html
|
|
displayName: 'Run Tests'
|
|
|
|
- script: |
|
|
gofmt -s -l -w . >&2
|
|
displayName: 'Format Check'
|
|
failOnStderr: true
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PublishTestResults@2
|
|
inputs:
|
|
testRunner: JUnit
|
|
testResultsFiles: report.xml
|
|
failTaskOnFailedTests: true
|
|
|
|
- task: PublishCodeCoverageResults@1
|
|
inputs:
|
|
codeCoverageTool: Cobertura
|
|
summaryFileLocation: coverage.xml
|
|
additionalCodeCoverageFiles: coverage.html
|