Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions .github/workflows/build-pypolyline.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/urschrei/pypolyline/blob/v0.5.8/.github/workflows/wheels.yml
# This workflow is based on `[tool.cibuildwheel]` in
# https://github.com/urschrei/pypolyline/blob/v1.0.0/pyproject.toml
name: Build pypolyline wheels (riscv64)

on:
Expand Down Expand Up @@ -31,10 +32,6 @@ permissions:

env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
# The urschrei/polyline-ffi tag that was latest when pypolyline 0.5.8 shipped.
# Upstream's own CI fetches whatever tag is latest at release time; it has no
# riscv64 release asset, so this is built from source instead (gotcha 77).
POLYLINE_FFI_TAG: v0.8.0

jobs:
setup:
Expand All @@ -46,16 +43,13 @@ jobs:
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build pypolyline ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
name: Build pypolyline ${{ matrix.version }} cp311-abi3-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# Upstream builds cp310-cp314 only (no free-threaded variant); this repo's
# floor is cp312, so cp314t is dropped along with cp310/cp311.
python: ["cp312", "cp313", "cp314"]

env:
PYPOLYLINE_VERSION: ${{ matrix.version }}
Expand All @@ -68,46 +62,52 @@ jobs:
ref: v${{ env.PYPOLYLINE_VERSION }}
persist-credentials: false

# 1.0.0 is a rewrite as a pure Rust/PyO3 extension built by maturin (the
# earlier releases were Cython over a prebuilt libpolylineffi), with
# pyo3's abi3-py311 feature on: one wheel serves every CPython >= 3.11.
# It is built on cp312, the oldest interpreter this repo's image has.
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
only: cp312-manylinux_riscv64
env:
CIBW_ARCHS: riscv64
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# Upstream downloads a prebuilt libpolylineffi.so from
# urschrei/polyline-ffi's releases; there is no riscv64 asset, so build
# it from source instead (gotcha 77) and stage it where
# CMakeLists.txt's find_library expects it.
# manylinux images ship no Rust toolchain (upstream's before-all, minus
# its macOS-only parts). Without cargo on PATH maturin falls back to
# puccinialin, which has no riscv64 toolchain to install.
CIBW_BEFORE_ALL_LINUX: >-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y &&
git clone --depth 1 --branch ${{ env.POLYLINE_FFI_TAG }}
https://github.com/urschrei/polyline-ffi /tmp/polyline-ffi &&
cd /tmp/polyline-ffi &&
$HOME/.cargo/bin/cargo build --release --features headers &&
cp target/release/libpolylineffi.so include/header.h {project}/src/pypolyline/
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sh -s -- -y --profile minimal
CIBW_ENVIRONMENT_LINUX: PATH="$HOME/.cargo/bin:$PATH"
# cibuildwheel's build[uv] frontend (upstream's pyproject.toml default)
# crashes the audit step: it asserts a host `uv`, which the self-hosted
# riscv64 runner doesn't have (gotcha 13).
CIBW_BUILD_FRONTEND: build
# numpy/cython have riscv64 wheels only on our registry.
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy
# numpy has riscv64 wheels only on our registry; tests that need it
# importorskip it, so it is installed to run them rather than skip them.
CIBW_TEST_ENVIRONMENT: >-
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
PIP_ONLY_BINARY=numpy
CIBW_TEST_REQUIRES: pytest numpy
CIBW_TEST_COMMAND: pytest {package}

- name: Check the licence made it into the wheel
- name: Check the extension and the licence made it into the wheel
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
for whl in sys.argv[1:]:
assert "-cp311-abi3-" in whl, whl
names = zipfile.ZipFile(whl).namelist()
assert any(n.startswith("pypolyline/cutil.") and n.endswith(".so")
for n in names), names
assert any(n.endswith("dist-info/licenses/LICENSE.md") for n in names), names
print(whl, "ok")
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pypolyline-${{ env.PYPOLYLINE_VERSION }}-${{ matrix.python }}-manylinux_riscv64
name: pypolyline-${{ env.PYPOLYLINE_VERSION }}-cp311-abi3-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

Expand Down
1 change: 1 addition & 0 deletions docs/packages/pypolyline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ versions:
- filename: pypolyline-0.5.8-cp314-cp314-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl
sha256: d71a335b469e8e08f8c0b7c65219664c0c782c8d1a0c3902697ed37bfff4b054
requires-python: '>=3.10'
- version: 1.0.0
Loading