Skip to content

Commit 64232a0

Browse files
[CI] Setup proper Azp (sonic-net#106)
Signed-off-by: Shilong Liu <[email protected]>
1 parent 9d019b0 commit 64232a0

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

azure-pipelines.yml

+32-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55

6-
pool: sonicbld
7-
86
trigger:
97
branches:
108
include:
@@ -21,19 +19,43 @@ stages:
2119
- job:
2220
displayName: "build"
2321
timeoutInMinutes: 60
22+
pool:
23+
vmImage: ubuntu-20.04
24+
25+
container:
26+
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest
27+
2428
steps:
2529
- checkout: self
2630
clean: true
2731
submodules: recursive
2832
displayName: 'Checkout code'
2933
- script: |
30-
echo Hello
31-
# the following is copied from jenkins
32-
# set -ex
33-
# python2 setup.py bdist_wheel
34-
# python3 setup.py bdist_wheel
35-
# mkdir -p target/python-wheels/
36-
# cp dist/swsssdk-2.0.1-{py2,py3}-none-any.whl target/python-wheels/
37-
- publish: $(System.DefaultWorkingDirectory)/target/python-wheels/
34+
set -ex
35+
36+
python3 setup.py bdist_wheel
37+
mkdir -p $(Build.ArtifactStagingDirectory)/target/python-wheels
38+
cp dist/*.whl $(Build.ArtifactStagingDirectory)/target/python-wheels/
39+
displayName: "Build"
40+
- script: |
41+
set -ex
42+
43+
sudo python3 -m pip install dist/swsssdk-2.0.1-py3-none-any.whl
44+
python3 setup.py test
45+
displayName: "Unit tests"
46+
- publish: $(Build.ArtifactStagingDirectory)
3847
artifact: sonic-py-swsssdk
3948
displayName: "Archive artifacts"
49+
- task: PublishTestResults@2
50+
inputs:
51+
testResultsFiles: '$(System.DefaultWorkingDirectory)/test-results.xml'
52+
testRunTitle: Python 3
53+
failTaskOnFailedTests: true
54+
condition: succeededOrFailed()
55+
displayName: 'Publish Python 3 test results'
56+
- task: PublishCodeCoverageResults@1
57+
inputs:
58+
codeCoverageTool: Cobertura
59+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
60+
reportDirectory: '$(System.DefaultWorkingDirectory)/htmlcov/'
61+
displayName: 'Publish Python 3 test coverage'

pytest.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = --cov=src --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -vv

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[aliases]
2+
test=pytest

0 commit comments

Comments
 (0)