forked from PixarAnimationStudios/OpenUSD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pypi-pipeline.yml
295 lines (285 loc) · 10.6 KB
/
azure-pypi-pipeline.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
name: PyPI_Packaging
# Trigger this build whenever this pipeline file is changed, or when setup.py
# or other supporting files are updated. This way we will build new pypi
# packages each time we update the version number, or any other information
# listed here or in setup.py, like supported python versions.
trigger:
branches:
include:
- dev
- release
paths:
include:
- azure-pypi-pipeline.yml
- build_scripts/pypi/*.py
- build_scripts/pypi/package_files/*
exclude:
- /
stages:
- stage: Build_and_Package
jobs:
- job: Linux
strategy:
matrix:
Python36:
PYTHON_INTERPRETER: /opt/python/cp36-cp36m/bin/python
PYTHON_TAG: cp36
Python37:
PYTHON_INTERPRETER: /opt/python/cp37-cp37m/bin/python
PYTHON_TAG: cp37
Python38:
PYTHON_INTERPRETER: /opt/python/cp38-cp38/bin/python
PYTHON_TAG: cp38
Python39:
PYTHON_INTERPRETER: /opt/python/cp39-cp39/bin/python
PYTHON_TAG: cp39
timeoutInMinutes: 90
pool:
vmImage: Ubuntu-18.04
steps:
- bash: |
docker build -t manylinuxwithcmake build_scripts/pypi/docker
docker run --name usdmanylinux --rm -id -v $(Build.SourcesDirectory):/opt/USD -v /home/vsts/dist:/opt/USD-dist manylinuxwithcmake
displayName: 'Creating docker build environment'
- bash: |
docker exec usdmanylinux $(PYTHON_INTERPRETER) build_scripts/build_usd.py --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pxr/pluginfo" --no-imaging --no-examples --no-tutorials --build /opt/USD/gen/build --src /opt/USD/gen/src /opt/USD/inst -v
displayName: 'Building USD'
- bash: |
docker exec usdmanylinux mkdir ./packaging
docker exec usdmanylinux cp -R /opt/USD/inst ./packaging
docker exec usdmanylinux sh -c 'cp build_scripts/pypi/package_files/* ./packaging'
docker exec usdmanylinux sh -c 'cp LICENSE.txt ./packaging'
displayName: "Creating packaging directory"
- bash: |
docker exec -w /opt/USD/packaging usdmanylinux $(PYTHON_INTERPRETER) setup.py bdist_wheel --python-tag ${PYTHON_TAG}
displayName: 'Running setup.py'
- bash: |
docker exec usdmanylinux /bin/bash -c 'PYTHONPATH=/opt/USD/packaging/pypi/lib/python LD_LIBRARY_PATH=/opt/USD/packaging/pypi/lib:$LD_LIBRARY_PATH auditwheel repair packaging/dist/*.whl'
displayName: 'Running auditwheel repair (moves .so files into package)'
- bash: |
WHEEL_PACKAGE_NAME=`docker exec usdmanylinux ls wheelhouse`
docker exec usdmanylinux $(PYTHON_INTERPRETER) build_scripts/pypi/updatePluginfos.py "wheelhouse/$WHEEL_PACKAGE_NAME" "/opt/USD-dist/$WHEEL_PACKAGE_NAME"
displayName: 'Updating pluginfo paths'
- bash: |
docker stop usdmanylinux
displayName: 'Stopping docker container'
- task: PublishPipelineArtifact@0
inputs:
artifactName: dist-linux-$(PYTHON_TAG)
targetPath: /home/vsts/dist
- job: Windows
strategy:
matrix:
Python36:
PYTHON_VERSION_SPEC: 3.6
PYTHON_TAG: cp36
Python37:
PYTHON_VERSION_SPEC: 3.7
PYTHON_TAG: cp37
Python38:
PYTHON_VERSION_SPEC: 3.8
PYTHON_TAG: cp38
Python39:
PYTHON_VERSION_SPEC: 3.9
PYTHON_TAG: cp39
timeoutInMinutes: 90
pool:
vmImage: 'VS2017-Win2016'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION_SPEC)
addToPath: true
- script: |
call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat
set BOOST_ROOT=
python --version
python build_scripts/build_usd.py --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pxr/pluginfo" --no-imaging --no-examples --no-tutorials --build %HOME%/USDgen/build --src %HOME%/USDgen/src %HOME%/USDinst -v
displayName: 'Building USD'
- script: |
dir
mkdir D:\packaging
xcopy /E /I %HOME%\USDinst D:\packaging\inst
copy build_scripts\pypi\package_files\* D:\packaging
copy LICENSE.txt D:\packaging
dir D:\packaging
dir D:\packaging\inst
displayName: "Creating packaging directory"
- script: |
python -m pip install wheel
displayName: 'Installing python packages'
- script: |
cd D:\packaging
dir
python setup.py bdist_wheel --python-tag $(PYTHON_TAG) --plat-name win_amd64
displayName: 'Running setup.py'
- task: PublishPipelineArtifact@0
inputs:
artifactName: dist-windows-$(PYTHON_TAG)
targetPath: D:\packaging\dist
- job: Mac
strategy:
matrix:
Python36:
PYTHON_VERSION_SPEC: 3.6
PYTHON_INTERPRETER: python3.6
PYTHON_TAG: cp36
Python37:
PYTHON_VERSION_SPEC: 3.7
PYTHON_INTERPRETER: python3.7
PYTHON_TAG: cp37
Python38:
PYTHON_VERSION_SPEC: 3.8
PYTHON_INTERPRETER: python3.8
PYTHON_TAG: cp38
Python39:
PYTHON_VERSION_SPEC: 3.9
PYTHON_INTERPRETER: python3.9
PYTHON_TAG: cp39
timeoutInMinutes: 90
pool:
vmImage: 'macOS-10.14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION_SPEC)
addToPath: true
- script: |
# The SYSTEM env var is used by the Makefile of glew and having it set trips it up
unset SYSTEM
/bin/bash -c "sudo xcode-select -s /Applications/Xcode_10.1.app/Contents/Developer"
$(PYTHON_INTERPRETER) build_scripts/build_usd.py --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pluginfo" --no-imaging --no-examples --no-tutorials --generator Xcode --build $HOME/USDgen/build --src $HOME/USDgen/src $HOME/USDinst -v
displayName: 'Building USD'
- bash: |
$(PYTHON_INTERPRETER) -m pip install delocate wheel
displayName: 'Installing python packages'
- bash: |
mkdir ./packaging
mkdir ./packaging/inst
cp -R $HOME/USDinst/* ./packaging/inst
cp build_scripts/pypi/package_files/* ./packaging
cp LICENSE.txt ./packaging
displayName: "Creating packaging directory"
- bash: |
cd ./packaging
$(PYTHON_INTERPRETER) setup.py bdist_wheel --python-tag ${PYTHON_TAG} --plat-name macosx_10_9_x86_64
displayName: 'Running setup.py'
- bash: |
delocate-wheel -v -w dist-delocated packaging/dist/*
displayName: 'Running delocate (moves shared lib files into package)'
- bash: |
WHEEL_PACKAGE_NAME=`ls ./packaging/dist`
mkdir -p ./dist
$(PYTHON_INTERPRETER) build_scripts/pypi/updatePluginfos.py "./dist-delocated/$WHEEL_PACKAGE_NAME" "./dist/$WHEEL_PACKAGE_NAME"
displayName: 'Updating pluginfo paths'
- task: PublishPipelineArtifact@0
inputs:
artifactName: dist-mac-$(PYTHON_TAG)
targetPath: ./dist
- stage: Deliver
dependsOn: Build_and_Package
jobs:
- job: Collect_Packages
timeoutInMinutes: 15
pool:
vmImage: Ubuntu-18.04
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Downloading all artifacts'
inputs:
source: current
# Not specifying artifact names so we get all of them
downloadPath: '$(Pipeline.Workspace)'
- bash: |
cd $(Pipeline.Workspace)
mkdir dist-final
cp dist*/*.whl dist-final
displayName: 'Collecting whl packages'
- task: PublishPipelineArtifact@0
displayName: 'Publishing in a single download'
inputs:
artifactName: dist
targetPath: '$(Pipeline.Workspace)/dist-final'
# The matrix below is verbose. There is a way to do this with a more n x m
# syntax using a foreach loop kind of construct. For now, opting for the below
# because it seems easier to read. An example of the other approach can be
# found here:
# https://github.com/nedrebo/parameterized-azure-jobs
- stage: Test_Packages
dependsOn: Deliver
jobs:
- job: Test_Install
strategy:
matrix:
Linux_Python36:
PYTHON_VERSION_SPEC: 3.6
IMAGE: 'Ubuntu-18.04'
PYTHON_INTERPRETER: python3
Linux_Python37:
PYTHON_VERSION_SPEC: 3.7
IMAGE: 'Ubuntu-18.04'
PYTHON_INTERPRETER: python3
Linux_Python38:
PYTHON_VERSION_SPEC: 3.8
IMAGE: 'Ubuntu-18.04'
PYTHON_INTERPRETER: python3
Linux_Python39:
PYTHON_VERSION_SPEC: 3.9
IMAGE: 'Ubuntu-18.04'
PYTHON_INTERPRETER: python3
Windows_Python36:
PYTHON_VERSION_SPEC: 3.6
IMAGE: 'VS2017-Win2016'
PYTHON_INTERPRETER: python
Windows_Python37:
PYTHON_VERSION_SPEC: 3.7
IMAGE: 'VS2017-Win2016'
PYTHON_INTERPRETER: python
Windows_Python38:
PYTHON_VERSION_SPEC: 3.8
IMAGE: 'VS2017-Win2016'
PYTHON_INTERPRETER: python
Windows_Python39:
PYTHON_VERSION_SPEC: 3.9
IMAGE: 'VS2017-Win2016'
PYTHON_INTERPRETER: python
Mac_Python36:
PYTHON_VERSION_SPEC: 3.6
IMAGE: 'macOS-10.14'
PYTHON_INTERPRETER: python3
Mac_Python37:
PYTHON_VERSION_SPEC: 3.7
IMAGE: 'macOS-10.14'
PYTHON_INTERPRETER: python3
Mac_Python38:
PYTHON_VERSION_SPEC: 3.8
IMAGE: 'macOS-10.14'
PYTHON_INTERPRETER: python3
Mac_Python39:
PYTHON_VERSION_SPEC: 3.9
IMAGE: 'macOS-10.14'
PYTHON_INTERPRETER: python3
timeoutInMinutes: 10
pool:
vmImage: '$(IMAGE)'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION_SPEC)
addToPath: true
- task: DownloadPipelineArtifact@2
displayName: 'Downloading dist package'
inputs:
source: current
artifact: dist
downloadPath: '$(Pipeline.Workspace)'
- script: |
$(PYTHON_INTERPRETER) --version
$(PYTHON_INTERPRETER) -m pip install pytest
$(PYTHON_INTERPRETER) -m pip install --no-index --find-links=file://$(Pipeline.Workspace) usd-core
py.test --junitxml TEST-usdinstall.xml build_scripts/pypi/test.py
displayName: "Testing fresh pip install"
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunTitle: 'Test results for $(IMAGE) Python $(PYTHON_VERSION_SPEC)'