-
-
Notifications
You must be signed in to change notification settings - Fork 147
276 lines (242 loc) · 9.25 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
# SPDX-FileCopyrightText: 2024 Howetuft
#
# SPDX-License-Identifier: Apache-2.0
name: LuxCore Python Wheels
on:
workflow_dispatch:
push:
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: [ 9 ]
#python-minor: [ 12]
#os: [macos-14]
#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
BUILD_TYPE: Release
CXX_VERSION: 20
GCC_VERSION: 14
GLIBC_VERSION: 2_28
GH_TOKEN: ${{ github.token }}
PYTHON_MINOR: ${{ matrix.python-minor }}
steps:
- name: Configure git for long paths
shell: bash
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: Checkout main repository (LuxCore)
uses: actions/checkout@v4
- 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: Set Conan parameters
shell: bash
run: |
_build_type=$(echo "${{ env.BUILD_TYPE }}" | tr '[:upper:]' '[:lower:]')
_conan_home="${{ env.WORKSPACE }}/.conan2"
echo "CONAN_PRESET=conan-${_build_type}" >> $GITHUB_ENV
echo "CONAN_HOME=${_conan_home}" >> $GITHUB_ENV
- name: Configure ccache
uses: actions/github-script@v7
with:
script: |
const workspace = String.raw`${{ github.workspace }}`;
const envVariables = {
'cache-variant': String.raw`ccache`,
'CMAKE_CXX_COMPILER_LAUNCHER': String.raw`ccache`,
'CMAKE_C_COMPILER_LAUNCHER': String.raw`ccache`,
'CCACHE_CONFIGPATH': String.raw`${workspace}/ccache.conf`,
'CCACHE_DIR': String.raw`${workspace}/.ccache`,
'CCACHE_DEBUGDIR': String.raw`${workspace}/ccache-debug`,
'CCACHE_LOGFILE': String.raw`${workspace}/ccache.log`
};
for (const [key, value] of Object.entries(envVariables)) {
core.exportVariable(key, value);
}
# Update apt: needed to install ccache
- 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: Prepare msvc
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Prepare Linux
if: runner.os == 'Linux'
shell: bash
run: |
_V=${{ env.GCC_VERSION }}
_T=/opt/rh/gcc-toolset-${_V}/root
echo "TOOLSET_ROOT=${_T}" >> $GITHUB_ENV
echo "CXX=${_T}/usr/bin/g++" >> $GITHUB_ENV
echo "CC=${_T}/usr/bin/gcc" >> $GITHUB_ENV
echo "AR=${_T}/usr/bin/ar" >> $GITHUB_ENV
echo "RANLIB=${_T}/usr/bin/ranlib" >> $GITHUB_ENV
- name: Set MacOS deployment target
if: runner.os == 'macOS'
uses: actions/github-script@v7
with:
script: |
if ('${{ runner.arch }}' == 'X64') {
target = '10.15';
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);
# TODO: The following block is an ugly hack but, at the moment (2025-02-25),
# scikit-build-core lacks a preset parameter, so this is the only way
# I found to pass a calculated environment var to CMake build step
- name: Set M4 env var
if: runner.os != 'Windows'
uses: actions/github-script@v7
with:
script: |
if ('${{ runner.arch }}' == 'X64') {
arch = 'x86_64'
} else {
arch = 'armv8'
}
base = '${{ env.WORKSPACE }}/build/full_deploy/host/m4/1.4.19/Release/'
core.exportVariable('M4', base + arch + '/bin/m4')
# 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: quay.io/pypa/manylinux_${{ env.GLIBC_VERSION }}_x86_64
CIBW_ENVIRONMENT: >
SKBUILD_CMAKE_ARGS='--preset ${{ env.CONAN_PRESET }};-G Ninja;--log-level=VERBOSE'
SKBUILD_CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
LUX_GENERATOR='Ninja'
CIBW_ENVIRONMENT_PASS_LINUX: |
CC
CXX
BUILD_TYPE
GCC_VERSION
SANITIZE
ASAN_PATH
RUNNER_OS
RUNNER_ARCH
WORKSPACE
CMAKE_CXX_COMPILER_LAUNCHER
CMAKE_C_COMPILER_LAUNCHER
PYTHON_MINOR
BOOST_INSTALL_LAYOUT
SPDLOG_FMT_EXTERNAL
CXX_VERSION
CONAN_HOME
CONAN_PRESET
M4
CIBW_BEFORE_ALL_LINUX: |
# Install toolchain (gcc, ninja, ccache...)
dnf install -y epel-release
dnf install -y almalinux-release-devel
dnf install -y ninja-build wget ccache
dnf install -y perl-IPC-Cmd perl-Digest-SHA
# Manylinux_2_34 compatibility
if [[ ${{ env.GLIBC_VERSION }} != 2_28 ]]; then
dnf install -y perl-FindBin perl-lib
fi
pip install conan && make deps
CIBW_BEFORE_ALL_MACOS: |
pip install conan && make deps
CIBW_BEFORE_ALL_WINDOWS: |
pip install conan && make deps
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
paths=$(find /project -type d -wholename "*/lib" -print0 | xargs -0 realpath | tr "\n" ":")
LD_LIBRARY_PATH=$paths:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
## Check build data
unzip {wheel} -d /tmp/wheel
readelf --string-dump .comment /tmp/wheel/pyluxcore/pyluxcore.so
auditwheel \
--verbose repair -w {dest_dir} \
--plat manylinux_${{ env.GLIBC_VERSION }}_x86_64 \
--only-plat \
${{ env.BUILD_TYPE == 'Release' && '--strip' || '' }} \
{wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: |
bash.exe ${{ env.WORKSPACE }}/scripts/repair_wheel_windows.sh '{wheel}' '{dest_dir}' '%VCToolsRedistDir%%Platform%' '${{ env.WORKSPACE }}'
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
cp {wheel} ${{ env.WORKSPACE }}
paths=$(find ${{ env.WORKSPACE }} -type d -wholename "*/lib" -print0 | xargs -0 realpath | tr "\n" ":")
DYLD_LIBRARY_PATH=$paths:$DYLD_LIBRARY_PATH
echo "DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH
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 issue
pyluxcoretest
fi
CIBW_CONTAINER_ENGINE: >
docker;
create_args:
--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