From 4e063e4ade89943f2413a767f24564aecfa2cd1c Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 3 Apr 2021 23:38:52 -0700 Subject: [PATCH] [ci]: setup proper azp Signed-off-by: Guohan Lu --- azure-pipelines.yml | 60 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f463e2e8d35c..09ee1dbafe91 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,9 +3,6 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml -pool: - vmImage: sonicbld - trigger: branches: include: @@ -22,18 +19,61 @@ stages: - job: displayName: "build" timeoutInMinutes: 60 + + pool: + vmImage: ubuntu-20.04 + + container: + image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest + steps: - checkout: self clean: true submodules: recursive displayName: 'Checkout code' + + - task: DownloadPipelineArtifact@2 + inputs: + source: specific + project: build + pipeline: 1 + artifact: sonic-buildimage.vs + runVersion: 'latestFromBranch' + runBranch: 'refs/heads/master' + displayName: "Download sonic buildimage" + + - script: | + set -ex + + sudo dpkg -i ../target/debs/buster/{libswsscommon_1.0.0_amd64.deb,python3-swsscommon_1.0.0_amd64.deb,libnl-3-200_*.deb,libnl-genl-3-200_*.deb,libnl-nf-3-200_*.deb,libnl-route-3-200_*.deb,libhiredis0.14_*.deb} + sudo python3 -m pip install ../target/python-wheels/swsssdk*-py3-*.whl + sudo python3 -m pip install ../target/python-wheels/sonic_py_common-1.0-py3-none-any.whl + python3 setup.py bdist_wheel + cp dist/*.whl $(Build.ArtifactStagingDirectory)/ + displayName: "Build" + - script: | - echo Hello - # the following is copied from jenkins - # set -ex - # ./scripts/common/python-asyncsnmp-build/build.sh - # ./scripts/common/python-asyncsnmp-build/test.sh - - publish: $(System.DefaultWorkingDirectory)/target/python-wheels/ + set -ex + + sudo python3 -m pip install dist/asyncsnmp-2.1.0-py3-none-any.whl + python3 setup.py test + displayName: "Unit tests" + + - task: PublishTestResults@2 + inputs: + testResultsFiles: '$(System.DefaultWorkingDirectory)/test-results.xml' + testRunTitle: Python 3 + failTaskOnFailedTests: true + condition: succeededOrFailed() + displayName: 'Publish Python 3 test results' + + - task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml' + reportDirectory: '$(System.DefaultWorkingDirectory)/htmlcov/' + displayName: 'Publish Python 3 test coverage' + + - publish: $(Build.ArtifactStagingDirectory)/ artifact: sonic-snmpagent displayName: "Archive artifacts" -