-
Notifications
You must be signed in to change notification settings - Fork 0
249 lines (229 loc) · 10 KB
/
Copy pathbuild-vtk.yml
File metadata and controls
249 lines (229 loc) · 10 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
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
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow mirrors the CMake flags VTK's own wheel CI passes in
# https://gitlab.kitware.com/vtk/vtk/-/blob/v9.7.0/.gitlab/ci/configure_wheel.cmake
# and the build recipe in .gitlab/os-linux.yml's .cmake_build_wheel_linux /
# .cmake_test_wheel_linux job templates (CMake + setup.py bdist_wheel, not
# cibuildwheel or scikit-build).
name: Build vtk wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/vtk.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-vtk.yml'
- 'docs/packages/vtk.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-vtk.yml'
- 'docs/packages/vtk.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: vtk
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build vtk ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 2880 # 48h: these runners have 4 cores, and a prior attempt was only
# ~42% through the ninja build (5095/12192 steps) after 7.5h -
# not hung, just a very large tree at this core count (same
# reasoning as build-nodejs-wheel-binaries.yml's 48h).
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# VTK is not abi3 (VTK_WRAP_PYTHON links directly against Python.h): upstream
# publishes one wheel per interpreter, rebuilding the whole tree each time.
python: ["cp312", "cp313", "cp314", "cp314t"]
env:
VTK_VERSION: ${{ matrix.version }}
steps:
- name: Checkout VTK v${{ env.VTK_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Kitware/VTK
ref: v${{ env.VTK_VERSION }}
submodules: false
persist-credentials: false
# Same OOM guard build-deltalake.yml/build-polars-runtime.yml need on these
# 4-core runners for other comparably large builds.
- name: Set swap space
uses: pierotofy/set-swap-space@fc79b3f67fa8a838184ce84a674ca12238d2c761 # master
with:
swap-size-gb: 10
- name: Write container script
run: |
mkdir -p build
cat > riscv64-build-and-test.sh <<'EOF'
#!/bin/bash
set -e -x
case "${PYTHON_TAG}" in
*t) python_dir="/opt/python/${PYTHON_TAG%t}-${PYTHON_TAG}/bin" ;;
*) python_dir="/opt/python/${PYTHON_TAG}-${PYTHON_TAG}/bin" ;;
esac
python_exe="${python_dir}/python"
case "$1" in
build)
dnf install -y --setopt=install_weak_deps=False ninja-build libX11-devel libXcursor-devel
# Mirrors .gitlab/ci/configure_wheel.cmake's own -D flags directly rather than
# including its configure_common.cmake tail: that file is upstream's *stock CI*
# config (VTK_BUILD_TESTING, VTK_LINKER_FATAL_WARNINGS ON, ...) meant to catch
# regressions on platforms Kitware already supports, not something that should
# decide whether a first-ever riscv64 build succeeds. VTK_BUILD_ALL_MODULES=ON
# is kept: it's what makes the built tree match the real, full "vtk" wheel.
cmake_args=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/build/install
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON
-DVTK_BUILD_ALL_MODULES=ON
-DVTK_BUILD_TESTING=OFF
-DVTK_BUILD_EXAMPLES=OFF
-DVTK_WHEEL_BUILD=ON
-DVTK_INSTALL_SDK=ON
-DVTK_ENABLE_REMOTE_MODULES=OFF
-DVTK_DEBUG_LEAKS=OFF
-DVTK_BUILD_PYI_FILES=ON
-DVTK_USE_PCH=OFF
-DVTK_GROUP_ENABLE_Qt=NO
-DVTK_MODULE_ENABLE_VTK_CommonArchive=NO
-DVTK_MODULE_ENABLE_VTK_DomainsMicroscopy=NO
-DVTK_MODULE_ENABLE_VTK_FiltersONNX=NO
-DVTK_MODULE_ENABLE_VTK_FiltersOpenTURNS=NO
-DVTK_MODULE_ENABLE_VTK_FiltersReebGraph=NO
-DVTK_MODULE_ENABLE_VTK_IOADIOS2=NO
-DVTK_MODULE_ENABLE_VTK_IOAlembic=NO
-DVTK_MODULE_ENABLE_VTK_IOFFMPEG=NO
-DVTK_MODULE_ENABLE_VTK_IOGDAL=NO
-DVTK_MODULE_ENABLE_VTK_IOLAS=NO
-DVTK_MODULE_ENABLE_VTK_IOMySQL=NO
-DVTK_MODULE_ENABLE_VTK_IONanoVDB=NO
-DVTK_MODULE_ENABLE_VTK_IOODBC=NO
-DVTK_MODULE_ENABLE_VTK_IOOpenVDB=NO
-DVTK_MODULE_ENABLE_VTK_IOPDAL=NO
-DVTK_MODULE_ENABLE_VTK_IOPostgreSQL=NO
-DVTK_MODULE_ENABLE_VTK_InfovisBoost=NO
-DVTK_MODULE_ENABLE_VTK_InfovisBoostGraphAlgorithms=NO
-DVTK_MODULE_ENABLE_VTK_RenderingFreeTypeFontConfig=NO
-DVTK_MODULE_ENABLE_VTK_RenderingOpenVR=NO
-DVTK_MODULE_ENABLE_VTK_RenderingOpenXR=NO
-DVTK_MODULE_ENABLE_VTK_RenderingZSpace=NO
# configure_options.cmake (pulled in by the configure_common.cmake tail we
# skip) resolves both of these to NO unless CMAKE_CONFIGURATION contains
# "ospray"/"helide" - true for upstream's real wheel jobs too, but ENABLE
# defaults to YES under VTK_BUILD_ALL_MODULES and hard-fails configure
# when the external anari/ospray package isn't found.
-DVTK_MODULE_ENABLE_VTK_RenderingAnari=NO
-DVTK_MODULE_ENABLE_VTK_RenderingRayTracing=NO
-DVTK_MODULE_ENABLE_VTK_conduit=NO
-DVTK_MODULE_ENABLE_VTK_fides=NO
-DVTK_MODULE_ENABLE_VTK_xdmf3=NO
-DVTK_MODULE_ENABLE_VTK_IOOCCT=NO
-DVTK_MODULE_ENABLE_VTK_IOIFC=NO
-DVTK_MODULE_ENABLE_VTK_IOUSD=NO
-DVTK_ENABLE_CATALYST=OFF
# riscv64 has no SIMD kernel in vendored libjpeg-turbo (ThirdParty/jpeg);
# upstream's default ON hard-fails configure when SIMD compilation
# isn't available for CMAKE_SYSTEM_PROCESSOR.
-DVTK_JPEG_ENABLE_SIMD=OFF
-DPython3_EXECUTABLE="${python_exe}"
-DPython3_FIND_STRATEGY=LOCATION
# CMake/vtkWheelPreparation.cmake defaults this to "dev0" and only
# skips it when $CI_COMMIT_TAG is set - upstream's own GitLab CI
# sets that for tag-triggered pipelines, but we build on GitHub
# Actions from the exact v9.7.0 tag with a clean tree, so without
# this override every wheel gets versioned 9.7.0.dev0 instead.
-DVTK_VERSION_SUFFIX=
)
case "${PYTHON_TAG}" in
*t) cmake_args+=(-DVTK_MODULE_ENABLE_VTK_IONetCDF=NO) ;;
esac
cmake -S /vtk -B /build -GNinja "${cmake_args[@]}"
# Mirrors ctest_build.cmake: a plain build (default target "all") first,
# then install as its own build invocation - ninja's install edge here
# doesn't transitively pull in every module's compile edge (e.g.
# libvtkWrappingTools.so) when targeted directly.
cmake --build /build --parallel "$(nproc)"
cmake --build /build --target install --parallel "$(nproc)"
cd /build
"${python_exe}" -m pip install -U setuptools wheel
"${python_exe}" setup.py bdist_wheel
auditwheel show dist/*.whl
auditwheel repair -w /build/wheelhouse dist/*.whl
;;
test)
"${python_exe}" -m venv /tmp/venv
. /tmp/venv/bin/activate
pip install -U pip
pip install /build/wheelhouse/*.whl
python -c "import vtk"
python -m vtkmodules.generate_pyi --test -p vtkmodules
;;
*)
echo "usage: $0 <build|test>" >&2
exit 1
;;
esac
EOF
- name: Build wheel
run: |
podman run -t \
--log-driver=none \
--network=host \
-v "${PWD}":/vtk \
-v "${PWD}/build":/build \
--workdir /vtk \
-e PYTHON_TAG="${{ matrix.python }}" \
--pull=newer \
"${MANYLINUX_RISCV64_IMAGE}" \
bash /vtk/riscv64-build-and-test.sh build
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vtk-${{ env.VTK_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: build/wheelhouse/*.whl
if-no-files-found: error
- name: Test wheel
run: |
podman run -t \
--log-driver=none \
--network=host \
-v "${PWD}":/vtk \
-v "${PWD}/build":/build \
--workdir /vtk \
-e PYTHON_TAG="${{ matrix.python }}" \
-e PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ \
"${MANYLINUX_RISCV64_IMAGE}" \
bash /vtk/riscv64-build-and-test.sh test
publish:
name: Publish vtk ${{ 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: vtk-${{ matrix.version }}-*-manylinux_riscv64