-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (95 loc) · 3.47 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
name: Build Python wheels
on:
workflow_dispatch:
inputs:
upload:
description: 'Upload wheels to PyPI? (0: no, 1: yes)'
required: true
default: '0'
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_SKIP: "*-musllinux* pp*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS_LINUX: auto64
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}"
CIBW_TEST_COMMAND: "python -c \"import mitsuba as mi; mi.set_variant(\\\"scalar_rgb\\\")\""
CIBW_TEST_SKIP: "*-macosx_arm64"
MACOSX_DEPLOYMENT_TARGET: 10.14
jobs:
build_wheels:
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
python: [cp38, cp39, cp310, cp311]
cibw-arch: [x86_64, arm64]
exclude:
- os: ubuntu-20.04
cibw-arch: arm64
- os: windows-latest
cibw-arch: arm64
fail-fast: false
name: >
${{ matrix.python }} wheel for ${{ matrix.os }}
${{ (matrix.os == 'macos-latest' && format('({0})', matrix.cibw-arch)) || '' }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
- 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.11.2
- name: Local build for macOS cross-compilation
if: runner.os == 'macOS' && matrix.cibw-arch == 'arm64'
run: |
pip install ninja cmake
mkdir build
cmake -B build -GNinja .
ninja -C build
- name: Prepare cibuildwheel environment for macOS
if: runner.os == 'macOS'
run: |
[[ "arm64" == "${{ matrix.cibw-arch }}" ]] && \
echo "MI_CMAKE_TOOLCHAIN_FILE=$(pwd)/.github/workflows/macOS_arm64_toolchain.cmake" >> $GITHUB_ENV && \
echo "CIBW_BEFORE_BUILD_MACOS=\
rm -rf /tmp/drjit_wheel && mkdir -p /tmp/drjit_wheel/ && cd /tmp/drjit_wheel && \
pip download --platform=macosx_11_0_arm64 --only-binary=:all: drjit==0.4.0 && \
unzip *.whl" >> $GITHUB_ENV && \
echo "MI_DRJIT_CMAKE_DIR=/tmp/drjit_wheel/drjit/share/cmake/drjit" >> $GITHUB_ENV && \
echo "MI_SRGB_COEFF_FILE=$(pwd)/build/data/srgb.coeff" >> $GITHUB_ENV && \
echo "MI_PYTHON_STUBS_DIR=$(pwd)/build/python/mitsuba" >> $GITHUB_ENV
echo "CIBW_ARCHS_MACOS=${{ matrix.cibw-arch }}" >> $GITHUB_ENV
- name: Build wheels
env:
CIBW_BUILD: ${{ matrix.python }}-*
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:
- uses: actions/download-artifact@v2
with:
name: wheels
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}