Skip to content

Commit

Permalink
[ci]: setup proper azp (#44)
Browse files Browse the repository at this point in the history
Signed-off-by: Guohan Lu <lguohan@gmail.com>
  • Loading branch information
lguohan authored Mar 31, 2021
1 parent 5615e5c commit eda0ca9
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .artifactignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*
!*.deb
85 changes: 74 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,95 @@ trigger:
branches:
include:
- master

pr:
branches:
include:
- master

pool:
vmImage: ubuntu-20.04

stages:
- stage: Build
jobs:
- job:
displayName: "build"
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: |
echo Hello
# the following is copied from jenkins
# set -ex
# ./scripts/common/sonic-mgmt-common-build/build.sh
# ./scripts/common/sonic-mgmt-common-build/test.sh
- publish: $(System.DefaultWorkingDirectory)/target/
# 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"

0 comments on commit eda0ca9

Please sign in to comment.