-
Notifications
You must be signed in to change notification settings - Fork 0
346 lines (307 loc) · 11.7 KB
/
wheels.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# SPDX-FileCopyrightText: 2024 Howetuft
#
# SPDX-License-Identifier: Apache-2.0
name: LuxCore Python wheels
on:
pull_request:
push:
branches:
- work
- cache
workflow_dispatch:
release:
types:
- published
jobs:
build_wheels:
name: Build wheel ${{ matrix.os }}-3.${{ matrix.python-minor }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-minor: [8, 9, 10, 11, 12, 13]
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
#python-minor: [ 12]
#os: [ubuntu-latest]
#python-minor: [ 11]
#os: [windows-latest]
#python-minor: [ 11]
#os: [macos-13]
exclude:
- os: macos-14
python-minor: 8
env:
# Reminder: report all variables here to CIBW_ENVIRONMENT_PASS_LINUX
GH_TOKEN: ${{ github.token }}
PYTHON_MINOR: ${{ matrix.python-minor }}
BOOST_INSTALL_LAYOUT: system
SPDLOG_FMT_EXTERNAL: on
# Versions
CXX_VERSION: 17
BOOST_VERSION: 1.84.0
OIIO_VERSION: 2.5.16.0
OCIO_VERSION: 2.4.0
OIDN_VERSION: 2.3.1
TBB_VERSION: 2021.12.0
OPENEXR_VERSION: 3.3.2
BLENDER_VERSION: 4.2.3
OPENVDB_VERSION: 11.0.0
SPDLOG_VERSION: 1.15.0
EMBREE3_VERSION: 3.13.5
FMT_VERSION: 11.0.2
steps:
- name: Configure git for long paths
shell: bash
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: Checkout main repository (LuxCoreWheel)
uses: actions/checkout@v4
- name: Checkout LuxCoreRender
uses: actions/checkout@v4
with:
repository: LuxCoreRender/LuxCore
path: LuxCore
submodules: recursive
ref: luxcorerender-v2.9alpha1
- name: Find workspace
shell: bash
run: |
case ${{ runner.os }} in
Linux) _workspace="/project";;
Windows) _workspace=$(cygpath -u $GITHUB_WORKSPACE);;
macOS) _workspace="$GITHUB_WORKSPACE";;
*) echo "Unhandled os ${{ runner.os }}";exit 64;;
esac
echo "WORKSPACE=${_workspace}" >> "$GITHUB_ENV"
- name: Configure ccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('cache-variant', 'ccache')
core.exportVariable('CMAKE_CXX_COMPILER_LAUNCHER', 'ccache');
core.exportVariable('CMAKE_C_COMPILER_LAUNCHER', 'ccache');
core.exportVariable('CCACHE_CONFIGPATH', String.raw`${{ github.workspace }}/ccache.conf`);
core.exportVariable('CCACHE_DIR', String.raw`${{ github.workspace }}/.ccache`);
core.exportVariable('CCACHE_DEBUGDIR', String.raw`${{ github.workspace }}/ccache-debug`);
core.exportVariable('CCACHE_LOGFILE', String.raw`${{ github.workspace }}/ccache.log`);
- name: Update apt (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update -y
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: false
variant: ${{ env.cache-variant }}
key: cpl-${{ matrix.os }}-${{ matrix.python-minor}}
restore-keys: cpl-${{ matrix.os }}-${{ matrix.python-minor}}-
max-size: 5G
verbose: 1
- name: Get cmake
if: runner.os == 'macOS' || runner.os == 'Windows'
uses: lukka/get-cmake@latest
- name: Install ISPC
if: runner.os == 'macOS' || runner.os == 'Windows'
uses: ispc/install-ispc-action@main
- name: Prepare msvc
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set MacOS deployment target
if: runner.os == 'macOS'
uses: actions/github-script@v7
with:
script: |
if ('${{ runner.arch }}' == 'X64') {
target = '10.13';
arch='x86_64';
}
else if ('${{ env.PYTHON_MINOR }}' != '8') {
target = '11.0';
arch='armv8';
}
else {
target = '12.0';
arch='armv8';
}
core.exportVariable('MACOSX_DEPLOYMENT_TARGET', target);
core.exportVariable('PKG_ARCH', arch);
- name: Patch source tree
shell: bash
run: source $GITHUB_WORKSPACE/scripts/patch_source_tree.sh
- name: Retrieve cached dependencies
id: retrieve-cache-deps
uses: actions/cache/restore@v4
with:
path: conan-cache
key: deps-${{ matrix.os }}-${{ matrix.python-minor}}-
restore-keys: deps-${{ matrix.os }}-${{ matrix.python-minor}}-
# Build wheel
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_FRONTEND: build
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: cp3${{ matrix.python-minor }}-*
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_ENVIRONMENT: >
SKBUILD_CMAKE_ARGS='--preset conan-release;-G Ninja;--log-level=VERBOSE'
CIBW_ENVIRONMENT_PASS_LINUX: |
RUNNER_OS
RUNNER_ARCH
WORKSPACE
CMAKE_CXX_COMPILER_LAUNCHER
CMAKE_C_COMPILER_LAUNCHER
PYTHON_MINOR
BOOST_INSTALL_LAYOUT
SPDLOG_FMT_EXTERNAL
CXX_VERSION
BOOST_VERSION
OIIO_VERSION
OCIO_VERSION
OIDN_VERSION
TBB_VERSION
OPENEXR_VERSION
BLENDER_VERSION
OPENVDB_VERSION
SPDLOG_VERSION
EMBREE3_VERSION
FMT_VERSION
CIBW_BEFORE_ALL_LINUX: |
dnf config-manager --set-enabled powertools
dnf install -y epel-release
dnf install -y ninja-build bison flex wget ccache perl-IPC-Cmd perl-Digest-SHA
ccache --show-config
# Install git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
dnf install -y git-lfs
# Install ispc
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2023-0/yum-dnf-zypper.html
tee > /tmp/oneAPI.repo << EOF
[oneAPI]
name=Intel® oneAPI repository
baseurl=https://yum.repos.intel.com/oneapi
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
EOF
mv /tmp/oneAPI.repo /etc/yum.repos.d
dnf install -y intel-oneapi-ispc
source /opt/intel/oneapi/ispc/latest/env/vars.sh
# TODO
## Install Cuda
#dnf install -y --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm
#dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm
#subscription-manager repos --enable "codeready-builder-for-rhel-8-$(uname -m)-rpms"
#dnf install -y xorg-x11-drv-nvidia-470xx-cuda-libs
CIBW_BEFORE_ALL_MACOS: |
brew install bison flex ispc
CIBW_BEFORE_BUILD: bash ${{ env.WORKSPACE }}/scripts/install_conan.sh
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
TBB=/project/full_deploy/host/onetbb/$TBB_VERSION/Release/x86_64/lib
OIDN=/project/full_deploy/host/oidn/$OIDN_VERSION/Release/x86_64/lib
EMBREE3=/project/full_deploy/host/embree3/$EMBREE3_VERSION/Release/x86_64/lib
HWLOC=/project/full_deploy/host/hwloc/2.9.3/Release/x86_64/lib
LEVEL_ZERO=/project/full_deploy/host/level-zero/1.17.39/Release/x86_64/lib
LD_LIBRARY_PATH=$TBB:$HWLOC:$LEVEL_ZERO:$OIDN:$EMBREE3:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
auditwheel \
--verbose repair -w {dest_dir} {wheel} \
--strip
pip install wheel
WHEEL=$(ls -1 {dest_dir}/*.whl)
python ${{ env.WORKSPACE }}/scripts/recompose_wheel_linux.py -- $WHEEL
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: |
bash.exe ${{ env.WORKSPACE }}/scripts/repair_wheel_windows.sh '{wheel}' '{dest_dir}' '%VCToolsRedistDir%%Platform%'
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
cp {wheel} ${{ env.WORKSPACE }}
BASE=${{ env.WORKSPACE }}/full_deploy/host
TBB=$BASE/onetbb/${{ env.TBB_VERSION }}/Release/${{ env.PKG_ARCH }}/lib
OIDN=$BASE/oidn/${{ env.OIDN_VERSION }}/Release/${{ env.PKG_ARCH }}/lib
EMBREE3=$BASE/embree3/${{ env.EMBREE3_VERSION }}/Release/${{ env.PKG_ARCH }}/lib
export DYLD_LIBRARY_PATH=$TBB:$OIDN:$EMBREE3
delocate-listdeps -v {wheel}
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_TEST_COMMAND_LINUX: pyluxcoretest
CIBW_TEST_COMMAND_WINDOWS: pyluxcoretest
CIBW_TEST_COMMAND_MACOS: |
if [[ ${{ matrix.os }} == 'macos-13' ]]; then
# Only for Intel: ARM runner raises an OpenCL driver error
pyluxcoretest
fi
CIBW_CONTAINER_ENGINE: >
docker;
create_args:
--mount type=bind,source=${{ github.workspace }}/conan-cache,target=/conan-cache
--mount type=bind,source=${{ env.CCACHE_DIR }},target=/root/.ccache
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- name: Save dependency cache
if: always()
id: cache-deps-save
uses: actions/cache/save@v4
with:
path: conan-cache
key: deps-${{ matrix.os }}-${{ matrix.python-minor}}-${{ hashFiles('**/conan-cache') }}
#- name: Setup tmate session
#uses: mxschmitt/action-tmate@v3
#- name: Setup tmate session (debug)
#if: ${{ failure() }}
#uses: mxschmitt/action-tmate@v3
# Upload artifacts
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.python-minor }}
path: ./wheelhouse/*.whl
upload_test:
needs: [build_wheels]
environment:
name: testpypi
url: https://test.pypi.org/p/pyluxcore
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
if: ${{ github.ref_name }} == 'work'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
verify-metadata: true
skip-existing: true
upload_prod:
needs: [build_wheels]
environment:
name: pypi
url: https://pypi.org/p/pyluxcore
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestations
uses: actions/[email protected]
with:
subject-path: "dist/*"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1