Repository navigation
194 lines (169 loc) · 7 KB
/
Copy pathbuild-usd-core.yml
File metadata and controls
194 lines (169 loc) · 7 KB
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
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Mirrors the Linux job of upstream's .github/workflows/pypi.yml: build_usd.py with
# imaging/MaterialX/examples/tutorials off, then build_scripts/pypi/{setup.py,
# updatePluginfos.py}, narrowed to riscv64.
name: Build usd-core wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/usd-core.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-usd-core.yml'
- 'docs/packages/usd-core.yaml'
- 'patches/usd-core/**'
push:
branches: [main]
paths:
- '.github/workflows/build-usd-core.yml'
- 'docs/packages/usd-core.yaml'
- 'patches/usd-core/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: usd-core
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build usd-core ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 1440
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# Upstream publishes cp39-cp314 and no free-threaded wheel; the
# pxr_boost::python bindings never declare Py_mod_gil, so a cp314t wheel
# would only re-enable the GIL.
python: ["cp312", "cp313", "cp314"]
env:
USD_CORE_VERSION: ${{ matrix.version }}
steps:
- name: Resolve the OpenUSD release tag
id: tag
run: |
set -euo pipefail
printf 'tag=v%s\n' \
"$(awk -F. '{printf "%s.%02d", $1, $2}' <<<"${USD_CORE_VERSION}")" >> "$GITHUB_OUTPUT"
- name: Checkout OpenUSD ${{ steps.tag.outputs.tag }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: PixarAnimationStudios/OpenUSD
ref: ${{ steps.tag.outputs.tag }}
persist-credentials: false
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
fetch-depth: 1
persist-credentials: false
- name: Patch OpenUSD
run: git apply python-wheels/patches/usd-core/${{ env.USD_CORE_VERSION }}/00*.patch
- name: Pull manylinux_riscv64 image
run: docker pull "${MANYLINUX_RISCV64_IMAGE}"
- name: Build USD and the wheel
run: |
mkdir -p dist
docker run -i --rm \
-v "${GITHUB_WORKSPACE}:/work" \
-w /work \
-e PYTHON_TAG="${{ matrix.python }}" \
"${MANYLINUX_RISCV64_IMAGE}" bash -s <<'USD_BUILD_EOF'
#!/usr/bin/env bash
set -euxo pipefail
PY="/opt/python/${PYTHON_TAG}-${PYTHON_TAG}/bin/python"
"$PY" -m pip install setuptools wheel
# Upstream's own pypi.yml hack: the manylinux image ships no libpython
# (PEP 513), and FindPython's Development component refuses to configure
# without the file even though PXR_PY_UNDEFINED_DYNAMIC_LOOKUP means USD
# never links against it.
"$PY" -c "import pathlib,sysconfig; pathlib.Path(sysconfig.get_config_var('LIBDIR'), sysconfig.get_config_var('LDLIBRARY')).touch()"
"$PY" build_scripts/build_usd.py --build-monolithic \
--build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_BUILD_EXEC=OFF -DPXR_INSTALL_LOCATION=../pxr/pluginfo -DPXR_PYTHON_INSTALL_DIR=lib/python" \
--no-materialx --no-imaging --no-examples --no-tutorials \
--build /work/gen/build --src /work/gen/src /work/inst -v
mkdir packaging
cp -R /work/inst ./packaging
cp build_scripts/pypi/package_files/* ./packaging
cp LICENSE.txt ./packaging
# auditwheel vendors the TBB shared library into the wheel, so its
# Apache-2.0 text has to travel with it; setuptools' default
# license_files glob picks LICENSE* up without a setup.py edit.
cp gen/src/oneTBB-*/LICENSE ./packaging/LICENSE.oneTBB.txt
cd packaging
"$PY" setup.py bdist_wheel --python-tag "${PYTHON_TAG}"
cd /work
PYTHONPATH=/work/packaging/pypi/lib/python \
LD_LIBRARY_PATH="/work/packaging/pypi/lib:${LD_LIBRARY_PATH:-}" \
auditwheel repair packaging/dist/*.whl
repaired="$(echo wheelhouse/*.whl)"
"$PY" build_scripts/pypi/updatePluginfos.py \
"${repaired}" "/work/dist/$(basename "${repaired}")"
ls -la /work/dist
USD_BUILD_EOF
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: usd-core-${{ env.USD_CORE_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: dist/*.whl
if-no-files-found: error
- name: Test usd-core wheel
run: |
docker run -i --rm \
-v "${GITHUB_WORKSPACE}:/work" \
-w /work \
-e PYTHON_TAG="${{ matrix.python }}" \
"${MANYLINUX_RISCV64_IMAGE}" bash -s <<'USD_TEST_EOF'
#!/usr/bin/env bash
set -euxo pipefail
PY="/opt/python/${PYTHON_TAG}-${PYTHON_TAG}/bin/python"
"$PY" -m pip install pytest
"$PY" -m pip install --no-index --find-links=/work/dist usd-core
# /work/pxr is the checkout's C++ source tree and would shadow the
# installed package as a namespace package, so run from elsewhere and
# prove which pxr was imported.
cd /tmp
"$PY" -c "
import pathlib, pxr
p = pathlib.Path(pxr.__file__)
print(p)
assert 'site-packages' in p.parts
import importlib, pkgutil
mods = sorted(m.name for m in pkgutil.iter_modules(pxr.__path__))
for m in mods:
importlib.import_module('pxr.' + m)
print(len(mods), 'modules imported:', ' '.join(mods))
assert 'Usd' in mods and 'Sdf' in mods and 'UsdGeom' in mods
"
"$PY" -m pytest -v /work/build_scripts/pypi/test.py
USD_TEST_EOF
publish:
name: Publish usd-core ${{ matrix.version }}
needs: [setup, build_wheels]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
artifact-pattern: usd-core-${{ matrix.version }}-*-manylinux_riscv64