-
Notifications
You must be signed in to change notification settings - Fork 87
/
azure-pipelines.yml
74 lines (67 loc) · 2.34 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
# 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
variables:
DIFF_COVER_CHECK_THRESHOLD: 80
DIFF_COVER_ENABLE: 'true'
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'
- script: |
set -x
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
# Note: pytest-azurepipelines 1.0.3 requires new version of pytest (dist version 3.10.1), which will break pytest-cov 2.6.0
sudo pip3 install pytest pytest-azurepipelines==0.8.0
sudo pip3 install pytest-cov
displayName: "Install build tools"
- script: |
set -ex
python3 setup.py bdist_wheel
mkdir -p $(Build.ArtifactStagingDirectory)/target/python-wheels
cp dist/*.whl $(Build.ArtifactStagingDirectory)/target/python-wheels/
displayName: "Build"
- script: |
set -ex
sudo python3 -m pip install dist/swsssdk-2.0.1-py3-none-any.whl
python3 -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml
displayName: "Unit tests"
- publish: $(Build.ArtifactStagingDirectory)
artifact: sonic-py-swsssdk
displayName: "Archive artifacts"
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: Python 3
failTaskOnFailedTests: true
condition: succeededOrFailed()
displayName: 'Publish Python 3 test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
additionalCodeCoverageFiles: '$(System.DefaultWorkingDirectory)/**/*.coverage'
displayName: 'Publish Python 3 test coverage'