|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the `cibuildwheel` job of |
| 5 | +# https://github.com/PRBonn/kiss-icp/blob/v1.3.0/.github/workflows/pypi.yml |
| 6 | +# and the tests of |
| 7 | +# https://github.com/PRBonn/kiss-icp/blob/v1.3.0/.github/workflows/python.yml |
| 8 | +name: Build kiss-icp wheels (riscv64) |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + version: |
| 14 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/kiss-icp.yaml not released yet' |
| 15 | + required: false |
| 16 | + default: '' |
| 17 | + pull_request: |
| 18 | + branches: [main] |
| 19 | + paths: |
| 20 | + - '.github/workflows/build-kiss-icp.yml' |
| 21 | + - 'docs/packages/kiss-icp.yaml' |
| 22 | + push: |
| 23 | + branches: [main] |
| 24 | + paths: |
| 25 | + - '.github/workflows/build-kiss-icp.yml' |
| 26 | + - 'docs/packages/kiss-icp.yaml' |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +permissions: |
| 33 | + contents: read # to fetch code (actions/checkout) |
| 34 | + |
| 35 | +env: |
| 36 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 37 | + |
| 38 | +jobs: |
| 39 | + setup: |
| 40 | + uses: $/.github/workflows/_setup.yml |
| 41 | + with: |
| 42 | + package: kiss-icp |
| 43 | + version: ${{ inputs.version }} |
| 44 | + |
| 45 | + build_wheels: |
| 46 | + needs: [setup] |
| 47 | + if: needs.setup.outputs.versions != '[]' |
| 48 | + name: Build kiss-icp ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 49 | + runs-on: ubuntu-24.04-riscv |
| 50 | + timeout-minutes: 180 |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 55 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 56 | + |
| 57 | + env: |
| 58 | + KISS_ICP_VERSION: ${{ matrix.version }} |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Checkout kiss-icp v${{ env.KISS_ICP_VERSION }} |
| 62 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 63 | + with: |
| 64 | + repository: PRBonn/kiss-icp |
| 65 | + ref: v${{ env.KISS_ICP_VERSION }} |
| 66 | + persist-credentials: false |
| 67 | + |
| 68 | + # oneTBB, Eigen, Sophus, robin-map and pybind11 are fetched at configure |
| 69 | + # time and compiled into the extension; upstream's wheel ships none of |
| 70 | + # their licences, and its in-tree 3rdparty/*/LICENSE copies are not the |
| 71 | + # pinned releases' own texts. |
| 72 | + - name: Stage the vendored dependencies' licences |
| 73 | + working-directory: python |
| 74 | + run: | |
| 75 | + set -euo pipefail |
| 76 | + curl -fsSL -o LICENSE.oneTBB https://raw.githubusercontent.com/uxlfoundation/oneTBB/v2022.1.0/LICENSE.txt |
| 77 | + curl -fsSL -o LICENSE.eigen https://gitlab.com/libeigen/eigen/-/raw/3.4.0/COPYING.MPL2 |
| 78 | + curl -fsSL -o LICENSE.sophus https://raw.githubusercontent.com/strasdat/Sophus/1.24.6/LICENSE.txt |
| 79 | + curl -fsSL -o LICENSE.robin-map https://raw.githubusercontent.com/Tessil/robin-map/v1.4.0/LICENSE |
| 80 | + curl -fsSL -o LICENSE.pybind11 https://raw.githubusercontent.com/pybind/pybind11/v3.1.0/LICENSE |
| 81 | +
|
| 82 | + - name: Stage the riscv64 smoke test |
| 83 | + run: | |
| 84 | + mkdir -p riscv64-tests |
| 85 | + cat > riscv64-tests/test_riscv64_smoke.py <<'EOF' |
| 86 | + import numpy as np |
| 87 | +
|
| 88 | + from kiss_icp.config import load_config |
| 89 | + from kiss_icp.kiss_icp import KissICP |
| 90 | + from kiss_icp.pybind import kiss_icp_pybind |
| 91 | +
|
| 92 | +
|
| 93 | + def _room(rng, n=4000): |
| 94 | + faces = [] |
| 95 | + for axis in range(3): |
| 96 | + for wall in (-8.0, 8.0) if axis < 2 else (-1.5, 3.0): |
| 97 | + pts = rng.uniform(-8.0, 8.0, size=(n, 3)) |
| 98 | + pts[:, 2] = rng.uniform(-1.5, 3.0, size=n) if axis < 2 else pts[:, 2] |
| 99 | + pts[:, axis] = wall |
| 100 | + faces.append(pts) |
| 101 | + return np.concatenate(faces) |
| 102 | +
|
| 103 | +
|
| 104 | + def test_extension_is_compiled(): |
| 105 | + assert kiss_icp_pybind.__file__.endswith(".so"), kiss_icp_pybind.__file__ |
| 106 | +
|
| 107 | +
|
| 108 | + def test_registration_recovers_motion(): |
| 109 | + rng = np.random.default_rng(0) |
| 110 | + scene = _room(rng) |
| 111 | + odometry = KissICP(load_config(None)) |
| 112 | + motion = np.array([0.4, -0.2, 0.05]) |
| 113 | + for step in range(4): |
| 114 | + odometry.register_frame(scene - step * motion, np.array([])) |
| 115 | + np.testing.assert_allclose(odometry.last_pose[:3, 3], 3 * motion, atol=0.05) |
| 116 | + np.testing.assert_allclose(odometry.last_pose[:3, :3], np.eye(3), atol=0.01) |
| 117 | + EOF |
| 118 | +
|
| 119 | + - name: Build wheels |
| 120 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 121 | + with: |
| 122 | + package-dir: python/ |
| 123 | + output-dir: wheelhouse/ |
| 124 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 125 | + env: |
| 126 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 127 | + # scikit-build-core 1.0 rejects the release's `cmake.minimum-version` |
| 128 | + # key; build-system.requires leaves it unpinned. |
| 129 | + CIBW_BEFORE_ALL: echo 'scikit-build-core<1' > /skbuild-constraint.txt |
| 130 | + CIBW_ENVIRONMENT: >- |
| 131 | + PIP_CONSTRAINT=/skbuild-constraint.txt |
| 132 | + PIP_BUILD_CONSTRAINT=/skbuild-constraint.txt |
| 133 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 134 | + CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy |
| 135 | + CIBW_TEST_SOURCES: python/tests riscv64-tests |
| 136 | + CIBW_TEST_REQUIRES: pytest |
| 137 | + CIBW_TEST_COMMAND: kiss_icp_pipeline --version && python -m pytest -rA python/tests riscv64-tests |
| 138 | + |
| 139 | + - name: Check wheel contents |
| 140 | + run: | |
| 141 | + python3 - wheelhouse/*.whl <<'EOF' |
| 142 | + import sys, zipfile |
| 143 | + for path in sys.argv[1:]: |
| 144 | + names = zipfile.ZipFile(path).namelist() |
| 145 | + sos = [n for n in names if n.endswith(".so")] |
| 146 | + assert any(n.startswith("kiss_icp/pybind/kiss_icp_pybind.") for n in sos), (path, sos) |
| 147 | + licences = {n.rsplit("/", 1)[-1] for n in names |
| 148 | + if ".dist-info/licenses/" in n} - {""} |
| 149 | + assert licences == {"LICENSE", "LICENSE.oneTBB", "LICENSE.eigen", "LICENSE.sophus", |
| 150 | + "LICENSE.robin-map", "LICENSE.pybind11"}, (path, licences) |
| 151 | + print(path, "->", sos) |
| 152 | + EOF |
| 153 | +
|
| 154 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 155 | + with: |
| 156 | + name: kiss-icp-${{ env.KISS_ICP_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 157 | + path: wheelhouse/*.whl |
| 158 | + if-no-files-found: error |
| 159 | + |
| 160 | + publish: |
| 161 | + name: Publish kiss-icp ${{ matrix.version }} |
| 162 | + needs: [setup, build_wheels] |
| 163 | + if: needs.setup.outputs.versions != '[]' |
| 164 | + strategy: |
| 165 | + fail-fast: false |
| 166 | + matrix: |
| 167 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 168 | + permissions: |
| 169 | + contents: write |
| 170 | + pull-requests: write |
| 171 | + uses: $/.github/workflows/_publish-wheel.yml |
| 172 | + secrets: |
| 173 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 174 | + with: |
| 175 | + artifact-pattern: kiss-icp-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments