Skip to content

Commit

Permalink
Add Azure pipeline config
Browse files Browse the repository at this point in the history
Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
  • Loading branch information
saiarcot895 committed May 16, 2022
1 parent 147d39f commit 02817d8
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .azure-pipelines/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
parameters:
- name: 'arch'
type: string
- name: 'pool'
type: object
default: {}
- name: 'containerImage'
type: string
- name: 'codeCoverage'
type: boolean
default: false

jobs:
- job:
displayName: ${{ parameters.arch }}
timeoutInMinutes: 60
pool: ${{ parameters.pool }}

container:
image: ${{ parameters.containerImage }}

steps:
- ${{ if and(eq(parameters.arch, 'amd64'), parameters.codeCoverage) }}:
- script: |
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get install -y dotnet-sdk-6.0
displayName: install .Net
- script: |
sudo apt-get install -y \
libboost-system-dev \
libboost-thread-dev \
googletest \
libgtest-dev \
libgmock-dev \
libhiredis-dev \
libnl-3-dev \
libnl-route-3-dev \
libnl-genl-3-dev \
libnl-nf-3-dev
displayName: "Install dependencies"
- checkout: self
clean: true
submodules: true
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
${{ if eq(parameters.arch, 'amd64') }}:
artifact: sonic-swss-common
${{ else }}:
artifact: sonic-swss-common.${{ parameters.arch }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
path: '$(Build.SourcesDirectory)/sonic-swss-common'
displayName: "Download sonic swss common deb packages"
- script: |
sudo dpkg -i sonic-swss-common/libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i sonic-swss-common/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
displayName: "Install sonic swss common"
- script: |
rm ../*.deb
dpkg-buildpackage -us -uc -b -j$(nproc)
cp ../*.deb $(Build.ArtifactStagingDirectory)
displayName: "Compile sonic dhcp-relay"
- publish: $(Build.ArtifactStagingDirectory)
artifact: sonic-dhcp-relay.${{ parameters.arch }}
displayName: "Archive dhcp-relay debian packages"
- ${{ if and(eq(parameters.arch, 'amd64'), parameters.codeCoverage) }}:
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: dhcprelay-test-result.xml
pathToSources: $(Build.SourcesDirectory)
codeCoverageTool: 'Cobertura'
29 changes: 29 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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

trigger:
branches:
include:
- "*"

jobs:
- template: .azure-pipelines/build.yml
parameters:
arch: amd64
pool:
vmImage: 'ubuntu-20.04'
codeCoverage: false
containerImage: sonicdev-microsoft.azurecr.io:443/sonic-slave-bullseye:latest
- template: .azure-pipelines/build.yml
parameters:
arch: arm64
pool: sonicbld-arm64
containerImage: sonicdev-microsoft.azurecr.io:443/sonic-slave-bullseye-arm64:latest
- template: .azure-pipelines/build.yml
parameters:
arch: armhf
pool: sonicbld-armhf
containerImage: sonicdev-microsoft.azurecr.io:443/sonic-slave-bullseye-armhf:latest

5 changes: 5 additions & 0 deletions azurepipelines-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status: # Code coverage status will be posted to pull requests based on targets defined below.
comments: on # Off by default. When on, details about coverage for each file changed will be posted as a pull request comment.
diff: # Diff coverage is code coverage only for the lines changed in a pull request.
target: 60% # Set this to a desired percentage. Default is 70 percent

0 comments on commit 02817d8

Please sign in to comment.