-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yaml
153 lines (128 loc) · 4.1 KB
/
azure-pipelines.yaml
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
name: $(Date:yyyyMMdd).$(Rev:r)
trigger:
batch: true
branches:
include: [ "*" ]
paths:
exclude: [ "README.md" ]
pr:
autoCancel: true
branches:
include: [ "*" ]
paths:
exclude: [ "README.md" ]
jobs:
- job: docker_ci
displayName: "Docker CI"
pool:
vmImage: "ubuntu-latest"
workspace:
clean: all
timeoutInMinutes: 30 # grpcio-tools build takes a long time
steps:
- checkout: 'self'
clean: true
submodules: 'recursive'
- bash: |
docker build --tag jamesits/pilot:azdevops-autobuild-latest .
displayName: 'Build'
- task: Docker@1
displayName: "Docker login"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: "Docker Hub: Jamesits"
command: login
- bash: |
docker push jamesits/pilot:azdevops-autobuild-latest
displayName: "Docker push"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: Docker@1
displayName: "Docker logout"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: "Docker Hub: Jamesits"
command: logout
- job: grpc_interface_build
displayName: "Build GRPC interface"
pool:
vmImage: "ubuntu-latest"
workspace:
clean: all
timeoutInMinutes: 10
steps:
- checkout: 'self'
clean: true
submodules: 'recursive'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
- bash: |
sudo -EH env "PATH=$PATH" scripts/build_grpc.sh
cp -r pilot/gobgp_interface/* ${BUILD_ARTIFACTSTAGINGDIRECTORY}
displayName: 'Build'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'gobgp_grpc_interface'
parallel: true
parallelCount: 10
- job: python_ci
displayName: "Python CI"
pool:
vmImage: "ubuntu-latest"
workspace:
clean: all
timeoutInMinutes: 10
strategy:
matrix:
Python37:
python.version: '3.7'
Python38:
python.version: '3.8'
steps:
- checkout: 'self'
clean: true
submodules: 'recursive'
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- bash: |
sudo -EH env "PATH=$PATH" python3 -m pip install --upgrade pip setuptools wheel mypy wemake-python-styleguide pytest pytest-cov
displayName: 'Install dependencies'
- bash: |
sudo -EH env "PATH=$PATH" python3 setup.py install
displayName: 'Install package'
- bash: |
sudo -EH env "PATH=$PATH" python3 setup.py sdist bdist_wheel
cp -r dist/* ${BUILD_ARTIFACTSTAGINGDIRECTORY}
displayName: 'Generate wheel package'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'wheel-$(python.version)'
parallel: true
parallelCount: 10
- bash: |
mypy --ignore-missing-imports .
displayName: 'Mypy check'
continueOnError: true
- script: |
flake8 --ignore=E501,F401,W503 --exclude=".git,__pycache__,docs/source/conf.py,old,build,dist,gobgp,pilot/gobgp_interface" .
displayName: 'flake8 check'
continueOnError: true
- script: |
pytest . --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html
displayName: 'pytest check'
continueOnError: true
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results for Python $(python.version)'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'