forked from sonic-net/sonic-mgmt-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
101 lines (76 loc) · 2.48 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
# 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
stages:
- stage: Build
jobs:
- job:
displayName: "Build"
timeoutInMinutes: 60
pool:
vmImage: ubuntu-20.04
container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest
steps:
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 1
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic buildimage"
- 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: |
ls -l
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc) && cp ../*.deb .
displayName: "Build"
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-mgmt-common
displayName: "Archive artifacts"
- script: |
# Run sanity tests for sonic-mgmt-common.
# Assumes sonic-mgmt-common is already compiled and all dependencies
# are installed.
set -x
STATUS=0
DEBDIR=$(realpath debian/sonic-mgmt-common)
[[ -f tools/test/database_config.json ]] && \
export DB_CONFIG_PATH=${PWD}/tools/test/database_config.json
# Run CVL tests
pushd build/tests/cvl
CVL_SCHEMA_PATH=testdata/schema \
./cvl.test -test.v -logtostderr || STATUS=1
popd
# Run translib tests
pushd build/tests/translib
export CVL_SCHEMA_PATH=${DEBDIR}/usr/sbin/schema
export YANG_MODELS_PATH=${DEBDIR}/usr/models/yang
./db.test -test.v -logtostderr || STATUS=1
./translib.test -test.v -logtostderr || STATUS=1
popd
exit ${STATUS}
displayName: "Sanity test"