Skip to content

Commit 709046b

Browse files
committed
Merge branch 'master' of github.com:sonic-net/sonic-host-services
2 parents f03c871 + 9fa4274 commit 709046b

File tree

3 files changed

+150
-1
lines changed

3 files changed

+150
-1
lines changed

azure-pipelines.yml

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Starter pipeline
2+
# Start with a minimal pipeline that you can customize to build and deploy your code.
3+
# Add steps that build, run tests, deploy, and more:
4+
# https://aka.ms/yaml
5+
6+
trigger:
7+
- master
8+
9+
resources:
10+
repositories:
11+
- repository: sonic-buildimage
12+
type: github
13+
name: Azure/sonic-buildimage
14+
endpoint: build
15+
16+
stages:
17+
- stage: Build
18+
19+
jobs:
20+
- job:
21+
displayName: "Python3"
22+
variables:
23+
DIFF_COVER_CHECK_THRESHOLD: 80
24+
DIFF_COVER_ENABLE: 'true'
25+
DIFF_COVER_WORKING_DIRECTORY: $(System.DefaultWorkingDirectory)/sonic-host-services
26+
pool:
27+
vmImage: ubuntu-20.04
28+
29+
container:
30+
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest
31+
32+
steps:
33+
- checkout: self
34+
clean: true
35+
submodules: recursive
36+
displayName: 'Checkout code'
37+
38+
- checkout: sonic-buildimage
39+
clean: true
40+
displayName: 'Checkout code'
41+
42+
- task: CopyFiles@2
43+
inputs:
44+
SourceFolder: '$(System.DefaultWorkingDirectory)/sonic-buildimage/src/sonic-host-services-data/'
45+
contents: '**'
46+
targetFolder: $(System.DefaultWorkingDirectory)/sonic-host-services-data/
47+
48+
- script: |
49+
sourceBranch=$(Build.SourceBranchName)
50+
if [[ "$(Build.Reason)" == "PullRequest" ]];then
51+
sourceBranch=$(System.PullRequest.TargetBranch)
52+
fi
53+
echo "Download artifact branch: $sourceBranch"
54+
echo "##vso[task.setvariable variable=sourceBranch]$sourceBranch"
55+
displayName: "Get correct artifact downloading branch"
56+
- task: DownloadPipelineArtifact@2
57+
inputs:
58+
source: specific
59+
project: build
60+
pipeline: 142
61+
artifact: sonic-buildimage.vs
62+
runVersion: 'latestFromBranch'
63+
runBranch: 'refs/heads/$(sourceBranch)'
64+
displayName: "Download artifacts from latest sonic-buildimage build"
65+
66+
- script: |
67+
set -xe
68+
sudo apt-get -y purge libhiredis-dev libnl-3-dev libnl-route-3-dev
69+
sudo dpkg -i libnl-3-200_*.deb
70+
sudo dpkg -i libnl-genl-3-200_*.deb
71+
sudo dpkg -i libnl-route-3-200_*.deb
72+
sudo dpkg -i libnl-nf-3-200_*.deb
73+
sudo dpkg -i libhiredis0.14_*.deb
74+
workingDirectory: $(Pipeline.Workspace)/target/debs/buster/
75+
displayName: 'Install Debian dependencies'
76+
77+
- task: DownloadPipelineArtifact@2
78+
inputs:
79+
source: specific
80+
project: build
81+
pipeline: 9
82+
artifact: sonic-swss-common
83+
runVersion: 'latestFromBranch'
84+
runBranch: 'refs/heads/master'
85+
displayName: "Download sonic swss common deb packages"
86+
87+
- script: |
88+
set -xe
89+
sudo dpkg -i libswsscommon_1.0.0_amd64.deb
90+
sudo dpkg -i python3-swsscommon_1.0.0_amd64.deb
91+
workingDirectory: $(Pipeline.Workspace)/
92+
displayName: 'Install swss-common dependencies'
93+
94+
- script: |
95+
set -xe
96+
sudo pip3 install swsssdk-2.0.1-py3-none-any.whl
97+
sudo pip3 install sonic_py_common-1.0-py3-none-any.whl
98+
workingDirectory: $(Pipeline.Workspace)/target/python-wheels/buster/
99+
displayName: 'Install Python dependencies'
100+
101+
- script: |
102+
set -ex
103+
# Install .NET CORE
104+
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
105+
sudo apt-add-repository https://packages.microsoft.com/debian/10/prod
106+
sudo apt-get update
107+
sudo apt-get install -y dotnet-sdk-5.0
108+
displayName: "Install .NET CORE"
109+
110+
- script: |
111+
pushd sonic-host-services
112+
113+
python3 setup.py test
114+
displayName: 'Test Python 3'
115+
116+
- task: PublishTestResults@2
117+
inputs:
118+
testResultsFiles: '$(System.DefaultWorkingDirectory)/sonic-host-services/test-results.xml'
119+
testRunTitle: Python 3
120+
failTaskOnFailedTests: true
121+
condition: succeededOrFailed()
122+
displayName: 'Publish Python 3 test results'
123+
124+
- task: PublishCodeCoverageResults@1
125+
inputs:
126+
codeCoverageTool: Cobertura
127+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/sonic-host-services/coverage.xml'
128+
reportDirectory: '$(System.DefaultWorkingDirectory)/sonic-host-services/htmlcov/'
129+
displayName: 'Publish Python 3 test coverage'
130+
131+
- script: |
132+
set -e
133+
pushd sonic-host-services
134+
python3 setup.py bdist_wheel
135+
displayName: 'Build Python 3 wheel'
136+
137+
- publish: '$(System.DefaultWorkingDirectory)/sonic-host-services/dist/'
138+
artifact: wheels
139+
displayName: "Publish Python wheels"
140+

lgtm.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
path_classifiers:
2+
test: "tests"
3+
4+
extraction:
5+
python:
6+
index:
7+
filters:
8+
- include: "host_modules/*.py"
9+
- include: "scripts/*"

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --ignore=tests/*/test*_vectors.py
2+
addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --ignore=tests/*/test*_vectors.py --junitxml=test-results.xml -vv

0 commit comments

Comments
 (0)