forked from nvidia-sonic/sonic-gnmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
159 lines (132 loc) · 4.43 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
# 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:
- master
pr:
branches:
include:
- master
resources:
repositories:
- repository: sonic-mgmt-common
type: github
name: sonic-net/sonic-mgmt-common
endpoint: sonic-net
- repository: sonic-swss-common
type: github
name: sonic-net/sonic-swss-common
endpoint: sonic-net
stages:
- stage: Build
jobs:
- job:
displayName: "build"
timeoutInMinutes: 60
pool:
vmImage: ubuntu-20.04
variables:
DIFF_COVER_CHECK_THRESHOLD: 80
DIFF_COVER_ENABLE: 'true'
DIFF_COVER_WORKING_DIRECTORY: $(System.DefaultWorkingDirectory)/sonic-gnmi
container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest
steps:
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'
- checkout: sonic-mgmt-common
clean: true
submodules: recursive
displayName: 'Checkout sonic-mgmt-common'
- checkout: sonic-swss-common
clean: true
submodules: recursive
displayName: 'Checkout sonic-swss-common'
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 1
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic buildimage"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 127
artifact: sonic-mgmt-common
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic-mgmt-common"
- script: |
# REDIS
sudo apt-get install -y redis-server
sudo sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf
sudo sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf
sudo sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf
sudo service redis-server start
# LIBYANG
sudo dpkg -i ../target/debs/buster/libyang*1.0.73*.deb
displayName: "Install dependency"
- script: |
# LIBSWSSCOMMON
sudo apt-get -y purge libhiredis-dev libnl-3-dev libnl-route-3-dev
sudo dpkg -i ../target/debs/buster/libnl-3-200_*.deb
sudo dpkg -i ../target/debs/buster/libnl-genl-3-200_*.deb
sudo dpkg -i ../target/debs/buster/libnl-route-3-200_*.deb
sudo dpkg -i ../target/debs/buster/libnl-nf-3-200_*.deb
sudo dpkg -i ../target/debs/buster/libhiredis0.14_*.deb
displayName: "Install libswsscommon 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"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: Azure.sonic-swss-common
artifact: sonic-swss-common
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic-swss-common"
- script: |
set -ex
# LIBSWSSCOMMON
sudo dpkg -i libswsscommon_1.0.0_amd64.deb
sudo dpkg -i libswsscommon-dev_1.0.0_amd64.deb
sudo dpkg -i python3-swsscommon_1.0.0_amd64.deb
workingDirectory: $(Pipeline.Workspace)/
displayName: 'Install libswsscommon package'
- script: |
set -ex
ls -l
pushd sonic-mgmt-common
NO_TEST_BINS=1 dpkg-buildpackage -rfakeroot -b -us -uc
popd
pushd sonic-gnmi
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc) && cp ../*.deb $(Build.ArtifactStagingDirectory)/
displayName: "Build"
- script: |
pushd sonic-gnmi
make check_gotest
displayName: "Test"
- publish: $(Build.ArtifactStagingDirectory)/
artifact: sonic-gnmi
displayName: "Archive artifacts"
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/sonic-gnmi/coverage.xml'
displayName: 'Publish coverage'