Skip to content

Commit

Permalink
[CI] Setup proper Azp (#106)
Browse files Browse the repository at this point in the history
Signed-off-by: Shilong Liu <shilongliu@microsoft.com>
  • Loading branch information
liushilongbuaa authored May 2, 2021
1 parent 9d019b0 commit 64232a0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
42 changes: 32 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

pool: sonicbld

trigger:
branches:
include:
Expand All @@ -21,19 +19,43 @@ 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'
- script: |
echo Hello
# the following is copied from jenkins
# set -ex
# python2 setup.py bdist_wheel
# python3 setup.py bdist_wheel
# mkdir -p target/python-wheels/
# cp dist/swsssdk-2.0.1-{py2,py3}-none-any.whl target/python-wheels/
- publish: $(System.DefaultWorkingDirectory)/target/python-wheels/
set -ex
python3 setup.py bdist_wheel
mkdir -p $(Build.ArtifactStagingDirectory)/target/python-wheels
cp dist/*.whl $(Build.ArtifactStagingDirectory)/target/python-wheels/
displayName: "Build"
- script: |
set -ex
sudo python3 -m pip install dist/swsssdk-2.0.1-py3-none-any.whl
python3 setup.py test
displayName: "Unit tests"
- publish: $(Build.ArtifactStagingDirectory)
artifact: sonic-py-swsssdk
displayName: "Archive artifacts"
- 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'
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = --cov=src --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -vv
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[aliases]
test=pytest

0 comments on commit 64232a0

Please sign in to comment.