-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
128 lines (112 loc) · 3.08 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
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
trigger:
branches:
include:
- master
- refs/tags/*
paths:
exclude:
- '*.md'
variables:
vmImage: 'ubuntu-16.04'
python_version: '3.7'
stages:
- stage: prebuild
jobs:
- job: 'code_check'
displayName: 'Code check'
continueOnError: true
pool:
vmImage: $(vmImage)
strategy:
matrix:
Python37:
python.version: $(python_version)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- script: |
python -m compileall .
displayName: 'Compile solution'
- script: |
python -m pip install flake8
flake8 ./pliptv
displayName: 'Run lint tests'
- job: 'type_check'
pool:
vmImage: $(vmImage)
strategy:
matrix:
Python37:
python.version: $(python_version)
continueOnError: true
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- script: |
python -m pip install mypy
make typecheck
displayName: 'Run typecheck'
- stage: test
dependsOn: prebuild
displayName: 'Tests'
jobs:
- job: 'tests'
pool:
vmImage: $(vmImage)
strategy:
matrix:
Python37:
python.version: '3.7'
displayName: Tests
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- script: |
pip install codecov
pip install -r requirements.txt -r requirements-dev.txt
coverage erase
coverage run -m unittest discover -p '*_test.py'
coverage report -m
coverage xml
codecov --token $CODECOV_TOKEN
displayName: 'Test with pytest && publish code coverage'
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
PL: $(PL)
EPG_INDEX_URL: $(EPG_INDEX_URL)
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
# reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
- script: |
pip install -r requirements.txt -r requirements-dev.txt
python -m xmlrunner discover -p '*_test.py' -o ./build/reports
env:
PL: $(PL)
EPG_INDEX_URL: $(EPG_INDEX_URL)
displayName: 'Unittests generate reports'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '$(System.DefaultWorkingDirectory)/build/reports/TEST-*.xml'
testRunTitle: 'Publish test results for Python $(python.version)'
- template: templates/stage-build-docker-image.yaml
parameters:
vmImage: $(vmImage)
- template: templates/stage-build-package.yaml
parameters:
vmImage: $(vmImage)
- template: templates/stage-deploy.yaml
parameters:
vmImage: $(vmImage)
environment: test_pypi
condition: succeeded('BuildPackage')
- template: templates/stage-deploy.yaml
parameters:
vmImage: $(vmImage)
environment: prod_pypi
condition: and(succeeded('DeployPackage_test_pypi'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))