-
Notifications
You must be signed in to change notification settings - Fork 1.2k
322 lines (317 loc) · 12.8 KB
/
pypi.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: PyPiPackaging
# Trigger this build whenever the dev or release branches are updated
# or on-demand.
#
# Ideally we'd run this pipeline for all pull requests, but doing so consumes
# our limited number of slots and almost always just duplicates the
# build done in the main pipeline.
on:
push:
branches:
- dev
- release
workflow_dispatch:
inputs:
post_release_tag:
description: 'post release tag'
default: ''
env:
POST_RELEASE_TAG: ${{ github.event.inputs.post_release_tag == '' && ' ' || format('--post-release-tag {0}', github.event.inputs.post_release_tag) }}
jobs:
Linux:
strategy:
matrix:
PYTHON:
- TAG: cp38
INTERPRETER: /opt/python/cp38-cp38/bin/python
VERSION_SPEC: '3.8'
- TAG: cp39
INTERPRETER: /opt/python/cp39-cp39/bin/python
VERSION_SPEC: '3.9'
- TAG: cp310
INTERPRETER: /opt/python/cp310-cp310/bin/python
VERSION_SPEC: '3.10'
- TAG: cp311
INTERPRETER: /opt/python/cp311-cp311/bin/python
VERSION_SPEC: '3.11'
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON.VERSION_SPEC }}
check-latest: false
- name: Setting up docker
run: |
docker build -t manylinuxwithcmake build_scripts/pypi/docker
docker run --name usdmanylinux --rm -id -v ./:/opt/USD -v /home/vsts/dist:/opt/USD-dist manylinuxwithcmake
- name: Building USD
run: |
# Terrible, terrible hack. The manylinux Docker image used to build the
# Python wheel does not include the corresponding Python shared library
# to link against. https://peps.python.org/pep-0513/#libpythonx-y-so-1
# describes why this is so. However, the FindPython CMake module used
# by USD's build system requires that the library exists and will error
# out otherwise, even though we explicitly avoid linking against Python
# via the PXR_PY_UNDEFINED_DYNAMIC_LOOKUP flag.
#
# To work around this, we create a dummy file for the library using
# the same logic as build_usd.py to determine where the library should
# exist (see GetPythonInfo). FindPython will see that the library exists
# and allow the build to continue. The file is 100% bogus, but the
# PXR_PY_UNDEFINED_DYNAMIC_LOOKUP flag will ensure that we never try to
# link against this library anyway, so it doesn't matter.
docker exec usdmanylinux ${{ matrix.PYTHON.INTERPRETER }} -c "import pathlib,sysconfig; pathlib.Path(sysconfig.get_config_var('LIBDIR'), sysconfig.get_config_var('LDLIBRARY')).touch()"
docker exec usdmanylinux ${{ matrix.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-materialx --no-imaging --no-examples --no-tutorials --build /opt/USD/gen/build --src /opt/USD/gen/src /opt/USD/inst -v
- name: Creating packaging directory
run: |
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'
- name: Running setup.py
run: |
docker exec -w /opt/USD/packaging usdmanylinux ${{ matrix.PYTHON.INTERPRETER }} setup.py ${{ env.POST_RELEASE_TAG }} bdist_wheel --python-tag ${{ matrix.PYTHON.TAG }}
- name: Running auditwheel repair (moves .so files into package)
run: |
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'
- name: Updating pluginfo paths
run: |
WHEEL_PACKAGE_NAME=`docker exec usdmanylinux ls wheelhouse`
docker exec usdmanylinux ${{ matrix.PYTHON.INTERPRETER }} build_scripts/pypi/updatePluginfos.py "wheelhouse/$WHEEL_PACKAGE_NAME" "/opt/USD-dist/$WHEEL_PACKAGE_NAME"
- name: Stopping docker container
run: |
docker stop usdmanylinux
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-linux-${{ matrix.PYTHON.TAG }}
path: /home/vsts/dist
macOS:
strategy:
matrix:
PYTHON:
- VERSION_SPEC: '3.8'
INTERPRETER: python3.8
TAG: cp38
- VERSION_SPEC: '3.9'
INTERPRETER: python3.9
TAG: cp39
- VERSION_SPEC: '3.10'
INTERPRETER: python3.10
TAG: cp310
- VERSION_SPEC: '3.11'
INTERPRETER: python3.11
TAG: cp311
runs-on: macos-13
timeout-minutes: 120
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON.VERSION_SPEC }}
check-latest: false
- name: Install dependencies
run: |
${{ matrix.PYTHON.INTERPRETER }} -m pip install --upgrade pip
${{ matrix.PYTHON.INTERPRETER }} -m pip install delocate~=0.10.2 wheel
- name: Build USD
run: |
sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer
${{ matrix.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-materialx --no-imaging --no-examples --no-tutorials --generator Xcode --build-target universal --build $GITHUB_WORKSPACE/USDgen/build --src $GITHUB_WORKSPACE/USDgen/src $GITHUB_WORKSPACE/USDinst -v
- name: Packaging USD
run: |
pwd
ls -la
mkdir ./packaging
mkdir ./packaging/inst
cp -R $GITHUB_WORKSPACE/USDinst/* ./packaging/inst
cp build_scripts/pypi/package_files/* ./packaging
cp LICENSE.txt ./packaging
ls -la ./packaging
ls -la ./packaging/inst
- name: Running setup.py
run: |
cd ./packaging
${{ matrix.PYTHON.INTERPRETER }} setup.py ${{ env.POST_RELEASE_TAG }} bdist_wheel --python-tag ${{ matrix.PYTHON.TAG }} --plat-name macosx_10_9_universal2
- name: Running delocate
run: |
# set DYLD_FALLBACK_LIBRARY_PATH for delocate-wheel to resolve libs
# https://github.com/pypa/cibuildwheel/issues/816
export DYLD_FALLBACK_LIBRARY_PATH=`readlink -f USDinst/lib`
echo $DYLD_FALLBACK_LIBRARY_PATH
ls -la $DYLD_FALLBACK_LIBRARY_PATH
delocate-wheel -vv -w dist-delocated packaging/dist/*
ls -la packaging/dist
ls -la dist-delocated
- name: Updating pluginfo paths
run: |
WHEEL_PACKAGE_NAME=`ls ./packaging/dist`
mkdir -p ./dist
ls -la ./packaging/dist
ls -la ./dist
${{ matrix.PYTHON.INTERPRETER }} build_scripts/pypi/updatePluginfos.py "./dist-delocated/$WHEEL_PACKAGE_NAME" "./dist/$WHEEL_PACKAGE_NAME"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-mac-${{ matrix.PYTHON.TAG }}
path: ./dist
Windows:
strategy:
matrix:
PYTHON:
- VERSION_SPEC: '3.8'
TAG: cp38
- VERSION_SPEC: '3.9'
TAG: cp39
- VERSION_SPEC: '3.10'
TAG: cp310
- VERSION_SPEC: '3.11'
TAG: cp311
runs-on: windows-2019
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON.VERSION_SPEC }}
check-latest: false
- name: Install dependencies
run: |
python -m pip install wheel
shell: cmd
- name: Build USD
run: |
call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
set BOOST_ROOT=
python --version
python build_scripts/build_usd.py --build-args USD,"-DPXR_ENABLE_PRECOMPILED_HEADERS=OFF -DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pxr/pluginfo" --no-materialx --no-imaging --no-examples --no-tutorials --build USDgen/build --src USDgen/src USDinst -v
shell: cmd
- name: Packaging USD
run: |
dir
mkdir D:\packaging
xcopy /E /I USDinst D:\packaging\inst
copy build_scripts\pypi\package_files\* D:\packaging
copy LICENSE.txt D:\packaging
dir D:\packaging
dir D:\packaging\inst
shell: cmd
- name: Running setup.py
run: |
D:
cd D:\packaging
python setup.py ${{ env.POST_RELEASE_TAG }} bdist_wheel --python-tag ${{ matrix.PYTHON.TAG }} --plat-name win_amd64
dir
shell: cmd
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-windows-${{ matrix.PYTHON.TAG }}
path: D:\packaging\dist
CollectPackages:
if: ${{ always() }}
needs: [Linux, macOS, Windows]
timeout-minutes: 5
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v4
with:
path: dist-final
pattern: dist-*-*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R dist-final
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist-final
Test:
needs: [CollectPackages]
timeout-minutes: 5
strategy:
matrix:
BUILD_CONFIG:
- NAME: Linux_Python38
PYTHON_VERSION_SPEC: '3.8'
IMAGE: ubuntu-20.04
PYTHON_INTERPRETER: python3
- NAME: Linux_Python39
PYTHON_VERSION_SPEC: '3.9'
IMAGE: ubuntu-20.04
PYTHON_INTERPRETER: python3
- NAME: Linux_Python310
PYTHON_VERSION_SPEC: '3.10'
IMAGE: ubuntu-20.04
PYTHON_INTERPRETER: python3
- NAME: Linux_Python311
PYTHON_VERSION_SPEC: '3.11'
IMAGE: ubuntu-20.04
PYTHON_INTERPRETER: python3
- NAME: Mac_Python38
PYTHON_VERSION_SPEC: '3.8'
IMAGE: macos-13
PYTHON_INTERPRETER: python3
- NAME: Mac_Python39
PYTHON_VERSION_SPEC: '3.9'
IMAGE: macos-13
PYTHON_INTERPRETER: python3
- NAME: Mac_Python310
PYTHON_VERSION_SPEC: '3.10'
IMAGE: macos-13
PYTHON_INTERPRETER: python3
- NAME: Mac_Python311
PYTHON_VERSION_SPEC: '3.11'
IMAGE: macos-13
PYTHON_INTERPRETER: python3
- NAME: Windows_Python38
PYTHON_VERSION_SPEC: '3.8'
IMAGE: windows-2019
PYTHON_INTERPRETER: python3
- NAME: Windows_Python39
PYTHON_VERSION_SPEC: '3.9'
IMAGE: windows-2019
PYTHON_INTERPRETER: python3
- NAME: Windows_Python310
PYTHON_VERSION_SPEC: '3.10'
IMAGE: windows-2019
PYTHON_INTERPRETER: python3
- NAME: Windows_Python311
PYTHON_VERSION_SPEC: '3.11'
IMAGE: windows-2019
PYTHON_INTERPRETER: python3
runs-on: ${{ matrix.BUILD_CONFIG.IMAGE }}
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.BUILD_CONFIG.PYTHON_VERSION_SPEC }}
check-latest: false
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: dist
merge-multiple: true
- name: Packaging USD
run: |
which python3
${{ matrix.BUILD_CONFIG.PYTHON_INTERPRETER }} --version
${{ matrix.BUILD_CONFIG.PYTHON_INTERPRETER }} -m pip install pytest
${{ matrix.BUILD_CONFIG.PYTHON_INTERPRETER }} -m pip install --no-index --find-links=file://${{ github.workspace }} usd-core
py.test --junitxml TEST-usdinstall-${{ matrix.BUILD_CONFIG.NAME }}.xml build_scripts/pypi/test.py
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: TEST-usdinstall-${{ matrix.BUILD_CONFIG.NAME }}
path: TEST-usdinstall-${{ matrix.BUILD_CONFIG.NAME }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}