forked from sonic-net/sonic-swss-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
165 lines (151 loc) · 4.93 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
164
165
# C/C++ with GCC
# Build your C/C++ project with GCC using make.
# Add steps that publish test results, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc
pr:
- master
- 202???
- 201???
trigger:
batch: true
branches:
include:
- master
- 202???
- 201???
# this part need to be set in UI
schedules:
- cron: "0 0 * * 6"
displayName: Weekly build
branches:
include:
- master
- 202???
- 201???
always: true
resources:
repositories:
- repository: sonic-sairedis
type: github
name: sonic-net/sonic-sairedis
endpoint: sonic-net
- repository: sonic-swss
type: github
name: sonic-net/sonic-swss
endpoint: sonic-net
parameters:
- name: debian_version
type: string
default: bullseye
variables:
- name: BUILD_BRANCH
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
value: $(System.PullRequest.TargetBranch)
${{ else }}:
value: $(Build.SourceBranchName)
stages:
- stage: Build
jobs:
- job:
displayName: "amd64/ubuntu-20.04"
pool:
vmImage: 'ubuntu-20.04'
steps:
- script: |
sudo apt-get update
sudo apt-get install -y make libtool m4 autoconf dh-exec debhelper cmake pkg-config nlohmann-json3-dev \
libhiredis-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev swig3.0 \
libpython2.7-dev libboost-dev libboost-serialization-dev uuid-dev libzmq5 libzmq3-dev
sudo apt-get install -y sudo
sudo apt-get install -y redis-server redis-tools
sudo apt-get install -y python3-pip
sudo pip3 install pytest
sudo apt-get install -y python
sudo apt-get install cmake libgtest-dev libgmock-dev libyang-dev
cd /usr/src/gtest && sudo cmake . && sudo make
ARCH=$(dpkg --print-architecture)
set -x
sudo curl -fsSL -o /usr/local/bin/bazel \
https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-${ARCH}
sudo chmod 755 /usr/local/bin/bazel
displayName: "Install dependencies"
- script: |
./autogen.sh
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc) && cp ../*.deb .
displayName: "Compile sonic swss common"
- script: |
bazel build //...
bazel test //...
displayName: "Compile and test all Bazel targets"
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-swss-common.amd64.ubuntu20_04
displayName: "Archive swss common debian packages"
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)
artifact_name: sonic-swss-common
run_unit_test: true
archive_gcov: true
debian_version: ${{ parameters.debian_version }}
- stage: BuildArm
dependsOn: Build
condition: succeeded('Build')
jobs:
- template: .azure-pipelines/build-template.yml
parameters:
arch: armhf
timeout: 180
pool: sonicbld-armhf
sonic_slave: sonic-slave-${{ parameters.debian_version }}-armhf:$(BUILD_BRANCH)
artifact_name: sonic-swss-common.armhf
debian_version: ${{ parameters.debian_version }}
- template: .azure-pipelines/build-template.yml
parameters:
arch: arm64
timeout: 180
pool: sonicbld-arm64
sonic_slave: sonic-slave-${{ parameters.debian_version }}-arm64:$(BUILD_BRANCH)
artifact_name: sonic-swss-common.arm64
debian_version: ${{ parameters.debian_version }}
- stage: BuildSairedis
dependsOn: Build
condition: succeeded('Build')
jobs:
- template: .azure-pipelines/build-sairedis-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)
swss_common_artifact_name: sonic-swss-common
artifact_name: sonic-sairedis
syslog_artifact_name: sonic-sairedis.syslog
debian_version: ${{ parameters.debian_version }}
- stage: BuildSwss
dependsOn: BuildSairedis
condition: succeeded('BuildSairedis')
jobs:
- template: .azure-pipelines/build-swss-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)
swss_common_artifact_name: sonic-swss-common
sairedis_artifact_name: sonic-sairedis
artifact_name: sonic-swss
debian_version: ${{ parameters.debian_version }}
- stage: BuildDocker
dependsOn: BuildSwss
condition: succeeded('BuildSwss')
jobs:
- template: .azure-pipelines/build-docker-sonic-vs-template.yml
parameters:
swss_common_artifact_name: sonic-swss-common
sairedis_artifact_name: sonic-sairedis
swss_artifact_name: sonic-swss
artifact_name: docker-sonic-vs
- stage: Test
dependsOn: BuildDocker
condition: succeeded('BuildDocker')
jobs:
- template: .azure-pipelines/test-docker-sonic-vs-template.yml
parameters:
log_artifact_name: log