forked from mitsuba-renderer/mitsuba3
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (110 loc) · 4.45 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
name: Build Python wheels
on:
workflow_dispatch:
inputs:
upload:
description: 'Upload wheels to PyPI? (0: no, 1: yes)'
required: true
default: '0'
env:
CIBW_TEST_COMMAND: "python -c \"import mitsuba\""
CIBW_TEST_REQUIRES: ""
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "python .github/workflows/tag_wheel_manylinux.py {wheel} {dest_dir}"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} --ignore-missing-dependencies {wheel}"
jobs:
build_wheels:
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-13, macos-14]
python: [cp38, cp39, cp310, cp311, cp312, cp313, cp313_stable]
exclude:
# The first Python version to target Apple arm64 architectures is 3.9
- os: macos-14
python: cp38
fail-fast: false
name: >
${{ matrix.python }} wheel for ${{ matrix.os }}
${{ (endsWith(matrix.python, '_stable') && '(stable ABI)') || '' }}
runs-on: ${{ matrix.os }}
steps:
###########################################################
# Setup local environment (source code, build requirements)
###########################################################
- uses: Wandalen/[email protected]
with:
action: actions/checkout@v3
with: |
submodules: recursive
attempt_limit: 3
attempt_delay: 2000
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'
# We need LLVM for stub generation
- name: Install LLVM and Clang
if: ${{ runner.os != 'macOS' }}
uses: KyleMayes/install-llvm-action@v2
with:
version: "17.0"
- name: Prepare compiler environment for Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.20.0
################################################################
# Set up envvars to build the correct wheel (stable ABI or not)
################################################################
- name: Prepare cibuildwheel environment (UNIX)
if: ${{ ! endsWith(matrix.python, '_stable') && runner.os != 'Windows' }}
run: |
echo "CIBW_BUILD=${{ matrix.python }}-*" >> $GITHUB_ENV
- name: Prepare cibuildwheel environment (Windows)
if: ${{ ! endsWith(matrix.python, '_stable') && runner.os == 'Windows' }}
run: |
echo "CIBW_BUILD=${{ matrix.python }}-*" >> $env:GITHUB_ENV
- name: Prepare cibuildwheel environment for stable ABI wheel (UNIX)
if: ${{ endsWith(matrix.python, '_stable') && runner.os != 'Windows' }}
run: |
stable_cp=$(echo ${{ matrix.python }} | cut -d_ -f1) &&
echo "CIBW_BUILD=${stable_cp}-*" >> $GITHUB_ENV &&
echo "CIBW_CONFIG_SETTINGS=\"wheel.py-api=cp312\" \"cmake.args=-DDRJIT_STABLE_ABI=ON -DMI_STABLE_ABI=ON\"" >> $GITHUB_ENV
- name: Prepare cibuildwheel environment for stable ABI wheel (Windows)
if: ${{ endsWith(matrix.python, '_stable') && runner.os == 'Windows' }}
run: |
$stable_cp = '${{ matrix.python }}' -split '_'
echo "CIBW_BUILD=$($stable_cp[0])-*" >> $env:GITHUB_ENV
echo "CIBW_CONFIG_SETTINGS=wheel.py-api=cp312 cmake.args=-DDRJIT_STABLE_ABI=ON -DMI_STABLE_ABI=ON" >> $env:GITHUB_ENV
#########################
# Build and store wheels
#########################
- name: Build wheel
env:
CIBW_ENVIRONMENT_LINUX: DRJIT_LIBLLVM_PATH=${{ env.LLVM_PATH }}/lib/libLLVM-17.so
CIBW_ENVIRONMENT_WINDOWS: DRJIT_LIBLLVM_PATH=${{ env.LLVM_PATH }}\bin\LLVM-C.dll
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
upload_pypi:
name: Upload wheels to PyPI
runs-on: ubuntu-latest
if: ${{ github.event.inputs.upload == '1'}}
needs: [build_wheels]
steps:
#########################
# Fetch and upload wheels
#########################
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}