Skip to content

Commit 2ad0728

Browse files
authored
👷 Build wheels for riscv64 (#88)
* 👷 Build wheels for riscv64 Support RISC-V instruction set architecture. Build on manylinux 2_31. * 👷 Run RISC-V job on ubuntu-24.04-riscv runner Courtesy of https://github.com/riseproject-dev/riscv-runner * ⚗️ Try using runner system Python for riscv64 * 🏗️ Do maturin build for riscv64 on manylinux_2_39 Specifically, the quay.io/repository/pypa/manylinux_2_39_riscv64 image which has linux/riscv64 docker builds. * 💚 Limit nvTIFF install to x86_64 and aarch64 only Not much CUDA binaries for RISC-V yet. * 💚 Install riscv64 build of maturin instead of x86_64 version * ⏪ Revert to PyO3/maturin-action, see if free-threaded builds work Fork no longer needed since PyO3/maturin-action#429 has been merged. * 🧑‍💻 Install riscv64 python wheels from extra index and make the RISC-V pytest checks run natively without going through QEMU. * 👽 Use riseproject-dev/setup-python to install Python 3.13 on riscv Get RISC-V builds of Python from https://github.com/riseproject-dev/python-versions, to get Python 3.13 instead of Python 3.12 system fallback on runner. * 🐛 Fix PIP_EXTRA_INDEX_URL, set PIP_PRE=1 for riscv64 matrix build Patches 2bc61d1, got the order swapped. Also set PIP_PRE=1 to try and get `numpy-2.5.0.dev0-cp313-cp313-linux_riscv64.whl` from the extra-index-url. * 🚚 Switch to alternative extra-index-url Find a source where libopenblas is packaged inside the numpy wheel. Xref https://riseproject.gitlab.io/python/wheel_builder/packages/numpy.html * 🔒 Fix a pedantic template expansion Xref https://docs.zizmor.sh/audits/#template-injection.
1 parent 3a34af4 commit 2ad0728

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is autogenerated by maturin v1.8.7
1+
# This file is autogenerated by maturin v1.12.6
22
# To update, run
33
#
44
# maturin generate-ci --pytest github
@@ -37,7 +37,9 @@ jobs:
3737
persist-credentials: false
3838

3939
- name: Update Rust toolchain
40-
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
40+
run: rustup update ${TOOLCHAIN} && rustup default ${TOOLCHAIN}
41+
env:
42+
TOOLCHAIN: ${{ matrix.toolchain }}
4143

4244
- name: Build
4345
run: cargo build --verbose
@@ -59,6 +61,9 @@ jobs:
5961
runner: ubuntu-24.04-arm
6062
arch: sbsa
6163
feat-flags: "cuda,pyo3"
64+
- target: riscv64
65+
runner: ubuntu-24.04-riscv
66+
manylinux: "2_39"
6267
- target: armv7
6368
- target: s390x
6469
- target: ppc64le
@@ -69,19 +74,26 @@ jobs:
6974
persist-credentials: false
7075

7176
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
77+
if: ${{ matrix.platform.target != 'riscv64' }}
7278
with:
7379
python-version: "3.13"
7480

81+
- uses: riseproject-dev/setup-python@8b57351c0f828145e2ac14bd328c731503361b7a # https://github.com/actions/setup-python/pull/1302
82+
if: ${{ matrix.platform.target == 'riscv64' }}
83+
with:
84+
python-version: "3.13"
85+
mirror: "https://raw.githubusercontent.com/riseproject-dev/python-versions/main"
86+
7587
- name: Build wheels
76-
uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1
88+
uses: PyO3/maturin-action@3f475a463fd27ce2440c13988f39fd1312dc9381
7789
with:
7890
target: ${{ matrix.platform.target }}
7991
args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13
8092
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
81-
manylinux: "2_28"
93+
manylinux: ${{ matrix.platform.manylinux || '2_28' }}
8294
before-script-linux: |
8395
# Install nvTIFF and clang-devel
84-
if command -v dnf &> /dev/null; then
96+
if command -v dnf &> /dev/null && test $(uname -m) != "riscv64"; then
8597
# https://developer.nvidia.com/nvtiff-0-6-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Rocky&target_version=8&target_type=rpm_network
8698
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/${{ matrix.platform.arch || 'x86_64' }}/cuda-rhel8.repo
8799
dnf clean all
@@ -97,15 +109,15 @@ jobs:
97109
fi
98110
99111
- name: Build free-threaded wheels
100-
uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1
112+
uses: PyO3/maturin-action@3f475a463fd27ce2440c13988f39fd1312dc9381
101113
with:
102114
target: ${{ matrix.platform.target }}
103115
args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13t
104116
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
105-
manylinux: "2_28"
117+
manylinux: ${{ matrix.platform.manylinux || '2_28' }}
106118
before-script-linux: |
107119
# Install nvTIFF and clang-devel
108-
if command -v dnf &> /dev/null; then
120+
if command -v dnf &> /dev/null && test $(uname -m) != "riscv64"; then
109121
# https://developer.nvidia.com/nvtiff-0-5-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Rocky&target_version=8&target_type=rpm_network
110122
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/${{ matrix.platform.arch || 'x86_64' }}/cuda-rhel8.repo
111123
dnf clean all
@@ -127,15 +139,17 @@ jobs:
127139
path: dist/
128140

129141
- name: pytest
130-
if: ${{ endswith(matrix.platform.target, '64') }} # x86_64 and aarch64
142+
if: ${{ endswith(matrix.platform.target, '64') }} # x86_64, aarch64, and riscv64
131143
shell: bash
132144
run: |
133145
set -e
134146
python3 -m venv .venv
135147
source .venv/bin/activate
136148
pip install cog3pio --no-index --no-deps --find-links dist --force-reinstall -vv
137-
pip install cog3pio --group tests
149+
pip install cog3pio --prefer-binary --group tests
138150
pytest --verbose
151+
env:
152+
PIP_EXTRA_INDEX_URL: ${{ matrix.platform.target == 'riscv64' && 'https://gitlab.com/api/v4/projects/56254198/packages/pypi/simple/' || '' }}
139153

140154
- name: pytest
141155
if: ${{ !endswith(matrix.platform.target, '64') && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x and ppc64le

0 commit comments

Comments
 (0)