forked from sonic-net/sonic-platform-daemons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
163 lines (146 loc) · 5.77 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
branches:
include:
- '*'
pool:
vmImage: 'ubuntu-20.04'
resources:
containers:
- container: sonic-slave-buster
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest
parameters:
- name: project_list
type: object
default:
- name: chassisd
root_dir: sonic-chassisd
python2: false
python3: true
- name: ledd
root_dir: sonic-ledd
python2: true
python3: true
- name: pcied
root_dir: sonic-pcied
python2: true
python3: true
- name: psud
root_dir: sonic-psud
python2: true
python3: true
- name: syseepromd
root_dir: sonic-syseepromd
python2: true
python3: true
- name: thermalctld
root_dir: sonic-thermalctld
python2: true
python3: true
- name: xcvrd
root_dir: sonic-xcvrd
python2: true
python3: true
jobs:
- ${{ each project in parameters.project_list }}:
- job: ${{ project.name }}
container: sonic-slave-buster
steps:
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 1
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download artifacts from latest sonic-buildimage build"
- script: |
set -xe
sudo apt-get -y purge libhiredis-dev libnl-3-dev libnl-route-3-dev
sudo dpkg -i libnl-3-200_*.deb
sudo dpkg -i libnl-genl-3-200_*.deb
sudo dpkg -i libnl-route-3-200_*.deb
sudo dpkg -i libnl-nf-3-200_*.deb
sudo dpkg -i libhiredis0.14_*.deb
sudo dpkg -i libswsscommon_1.0.0_amd64.deb
sudo dpkg -i python-swsscommon_1.0.0_amd64.deb
sudo dpkg -i python3-swsscommon_1.0.0_amd64.deb
workingDirectory: $(Pipeline.Workspace)/target/debs/buster/
displayName: 'Install Debian dependencies'
- script: |
set -xe
sudo pip2 install swsssdk-2.0.1-py2-none-any.whl
sudo pip2 install sonic_py_common-1.0-py2-none-any.whl
sudo pip2 install sonic_config_engine-1.0-py2-none-any.whl
sudo pip2 install sonic_platform_common-1.0-py2-none-any.whl
sudo pip3 install swsssdk-2.0.1-py3-none-any.whl
sudo pip3 install sonic_py_common-1.0-py3-none-any.whl
sudo pip3 install sonic_yang_mgmt-1.0-py3-none-any.whl
sudo pip3 install sonic_yang_models-1.0-py3-none-any.whl
sudo pip3 install sonic_config_engine-1.0-py3-none-any.whl
sudo pip3 install sonic_platform_common-1.0-py3-none-any.whl
workingDirectory: $(Pipeline.Workspace)/target/python-wheels/
displayName: 'Install Python dependencies'
- script: |
set -ex
# Install .NET CORE
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/debian/10/prod
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
displayName: "Install .NET CORE"
# Python 2
- ${{ if eq(project.python2, true) }}:
- script: |
python2 setup.py test
workingDirectory: ${{ project.root_dir }}
displayName: 'Test ${{ project.name }} (Python 2)'
- task: PublishTestResults@2
inputs:
testResultsFiles: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/test-results.xml'
testRunTitle: ${{ project.name }} (Python 2)
failTaskOnFailedTests: true
condition: succeededOrFailed()
displayName: 'Publish ${{ project.name }} (Python 2) test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/htmlcov/'
displayName: 'Publish ${{ project.name }} (Python 2) test coverage'
- script: |
set -e
python2 setup.py bdist_wheel
workingDirectory: ${{ project.root_dir }}
displayName: 'Build ${{ project.name }} (Python 2)'
# Python 3
- ${{ if eq(project.python3, true) }}:
- script: |
python3 setup.py test
workingDirectory: ${{ project.root_dir }}
displayName: 'Test ${{ project.name }} (Python 3)'
- task: PublishTestResults@2
inputs:
testResultsFiles: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/test-results.xml'
testRunTitle: ${{ project.name }} (Python 3)
failTaskOnFailedTests: true
condition: succeededOrFailed()
displayName: 'Publish ${{ project.name }} (Python 3) test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/htmlcov/'
displayName: 'Publish ${{ project.name }} (Python 3) test coverage'
- script: |
set -e
python3 setup.py bdist_wheel
workingDirectory: ${{ project.root_dir }}
displayName: 'Build ${{ project.name }} (Python 3)'
- publish: '$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/dist/'
artifact: ${{ project.root_dir }}
displayName: "Publish ${{ project.name }} wheels"