-
Notifications
You must be signed in to change notification settings - Fork 8
/
azurePipeline.yml
173 lines (168 loc) · 5.17 KB
/
azurePipeline.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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
trigger:
branches:
include:
- '*'
tags:
include:
- v*
stages:
- stage: wheels
displayName: Build Wheel Packages
variables:
# Need to install development libraries for manylinux container
CIBW_BEFORE_ALL_LINUX: 'yum install -y libffi-devel atlas-devel'
# Only build for Python36+, and x64 arch
CIBW_BUILD: 'cp310-* cp39-* cp38-*'
CIBW_SKIP: '*-win32 *-manylinux_i686 *-musllinux_*'
#CIBW_BEFORE_TEST: pip install -r {project}/requirements.txt
#CIBW_TEST_COMMAND: "pytest {project}/tests"
jobs:
- job: linux_310
displayName: Linux + Python3.10
pool:
vmImage: 'ubuntu-20.04'
variables:
CIBW_BUILD: 'cp310-*'
steps:
- { task: UsePythonVersion@0, inputs: { versionSpec: '3.10', architecture: x64 } }
- template: .azurePipeline/cibuildwheel_steps.yml
parameters:
artifactName: 'wheels.linux310'
- job: linux_39
displayName: Linux + Python3.9
pool:
vmImage: 'ubuntu-20.04'
variables:
CIBW_BUILD: 'cp39-*'
steps:
- { task: UsePythonVersion@0, inputs: { versionSpec: '3.9', architecture: x64 } }
- template: .azurePipeline/cibuildwheel_steps.yml
parameters:
artifactName: 'wheels.linux39'
- job: linux_38
displayName: Linux + Python3.8
pool:
vmImage: 'ubuntu-20.04'
variables:
CIBW_BUILD: 'cp38-*'
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.8', architecture: x64}}
- template: .azurePipeline/cibuildwheel_steps.yml
parameters:
artifactName: 'wheels.linux38'
- job: windows
displayName: Windows
pool:
vmImage: 'windows-2019'
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.8', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.9', architecture: x64}}
- template: .azurePipeline/cibuildwheel_steps.yml
parameters:
artifactName: 'wheels.windows'
- stage: sdist
displayName: Build source distribution
dependsOn: []
jobs:
- job: sdist
displayName: build source distribution
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'
- script: |
python setup.py sdist
displayName: 'Artifact creation'
- task: CopyFiles@2
inputs:
targetFolder: 'sdist'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'sdist/dist'
ArtifactName: 'drop'
- stage: test
displayName: Unit tests
dependsOn: ['wheels']
jobs:
- job:
displayName: Linux
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
Python3.8:
pythonVersion: '3.8'
artifactName: 'wheels.linux38'
Python3.9:
pythonVersion: '3.9'
artifactName: 'wheels.linux39'
steps:
- template: .azurePipeline/unittest_wheel_steps.yml
parameters:
artifactName: $(artifactName)
pythonVersion: $(pythonVersion)
operatingSystem: 'ubuntu-20.04'
- job:
displayName: Windows
pool:
vmImage: 'windows-2019'
strategy:
matrix:
Python3.8:
pythonVersion: '3.8'
artifactName: 'wheels.windows'
artifactPattern: '**/*cp38*.whl'
Python3.9:
pythonVersion: '3.9'
artifactName: 'wheels.windows'
artifactPattern: '**/*cp39*.whl'
steps:
- template: .azurePipeline/unittest_wheel_steps.yml
parameters:
artifactName: $(artifactName)
artifactPattern: $(artifactPattern)
pythonVersion: $(pythonVersion)
operatingSystem: 'windows-2019'
- stage: static_checks
displayName: Static Checks
dependsOn: []
jobs:
- job:
displayName: Typecheck
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'
- script: pip install -U mypy types-setuptools
- script: mypy anonlink --ignore-missing-imports
displayName: mypy
- stage: publish
displayName: Publish packages to test feed
dependsOn: ['test']
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
jobs:
- job:
pool:
vmImage: 'ubuntu-latest'
variables:
# the name of an Azure artifacts feed to publish artifacts to
artifactFeed: anonlink
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.8', architecture: x64}}
- script: 'pip install twine'
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'drop'
patterns: '**/*.@(whl|tar.gz)'
path: $(Pipeline.Workspace)
- task: TwineAuthenticate@1
inputs:
artifactFeed: $(artifactFeed)
- script: 'echo $(Build.Repository.Name)'
- script: 'echo $(Build.SourceBranchName)'
- script: 'twine upload -r $(artifactFeed) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/*.whl --skip-existing'
- script: 'twine upload -r $(artifactFeed) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/*.tar.gz --skip-existing'