|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on: https://github.com/cmake-wheel/cmeel-octomap/blob/v1.10.0.c5/.github/workflows/release.yml |
| 5 | +name: Build cmeel-octomap wheels (riscv64) |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + version: |
| 11 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/cmeel-octomap.yaml not released yet' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + pull_request: |
| 15 | + branches: [main] |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-cmeel-octomap.yml' |
| 18 | + - 'docs/packages/cmeel-octomap.yaml' |
| 19 | + push: |
| 20 | + branches: [main] |
| 21 | + paths: |
| 22 | + - '.github/workflows/build-cmeel-octomap.yml' |
| 23 | + - 'docs/packages/cmeel-octomap.yaml' |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read # to fetch code (actions/checkout) |
| 31 | + |
| 32 | +env: |
| 33 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 34 | + |
| 35 | +jobs: |
| 36 | + setup: |
| 37 | + uses: $/.github/workflows/_setup.yml |
| 38 | + with: |
| 39 | + package: cmeel-octomap |
| 40 | + version: ${{ inputs.version }} |
| 41 | + |
| 42 | + build_wheels: |
| 43 | + needs: [setup] |
| 44 | + if: needs.setup.outputs.versions != '[]' |
| 45 | + name: Build cmeel-octomap ${{ matrix.version }} manylinux_riscv64 |
| 46 | + runs-on: ubuntu-24.04-riscv |
| 47 | + timeout-minutes: 120 |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 52 | + |
| 53 | + env: |
| 54 | + CMEEL_OCTOMAP_VERSION: ${{ matrix.version }} |
| 55 | + |
| 56 | + steps: |
| 57 | + # cmeel-octomap's release tags carry a packaging-revision suffix (.c5) that is the |
| 58 | + # wheel's build tag, not part of its version; .c5 is the revision 1.10.0 released last. |
| 59 | + - name: Checkout cmeel-octomap v${{ env.CMEEL_OCTOMAP_VERSION }}.c5 |
| 60 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 61 | + with: |
| 62 | + repository: cmake-wheel/cmeel-octomap |
| 63 | + ref: v${{ env.CMEEL_OCTOMAP_VERSION }}.c5 |
| 64 | + submodules: true |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Build wheels |
| 68 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 69 | + with: |
| 70 | + output-dir: wheelhouse/ |
| 71 | + # has-sitelib = false: the wheel holds no Python extension, so one |
| 72 | + # py3-none wheel covers every interpreter. |
| 73 | + only: cp312-manylinux_riscv64 |
| 74 | + env: |
| 75 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 76 | + CIBW_ENVIRONMENT: CMEEL_LOG_LEVEL=DEBUG CMEEL_RUN_TESTS=false |
| 77 | + # cmeel installs into a shared prefix with an $ORIGIN RPATH it sets itself. |
| 78 | + CIBW_REPAIR_WHEEL_COMMAND: "" |
| 79 | + |
| 80 | + - name: Check wheel contents |
| 81 | + run: | |
| 82 | + python3 - wheelhouse/*.whl <<'EOF' |
| 83 | + import sys, zipfile |
| 84 | + names = zipfile.ZipFile(sys.argv[1]).namelist() |
| 85 | + assert "cmeel.prefix/lib/liboctomap.so.1.10.0" in names, names |
| 86 | + assert "cmeel.prefix/lib/liboctomath.so.1.10.0" in names, names |
| 87 | + assert "cmeel.prefix/include/octomap/OcTree.h" in names, names |
| 88 | + EOF |
| 89 | +
|
| 90 | + - name: Smoke-test the built library |
| 91 | + run: | |
| 92 | + sudo apt-get update -qq |
| 93 | + sudo apt-get install -y -qq --no-install-recommends python3-venv |
| 94 | + python3 -m venv .venv |
| 95 | + . .venv/bin/activate |
| 96 | + # gotcha 234: stock Ubuntu 24.04 apt pip (24.0) has zero manylinux_*_riscv64 |
| 97 | + # tags, so it rejects the riscv64 wheel outright without upgrading first. |
| 98 | + pip install -q --upgrade pip |
| 99 | + pip install -q wheelhouse/*.whl |
| 100 | + prefix=$(python3 -c "import pathlib, sysconfig; print(pathlib.Path(sysconfig.get_paths()['purelib']) / 'cmeel.prefix')") |
| 101 | + python3 -c "import ctypes; ctypes.CDLL('$prefix/lib/liboctomap.so')" |
| 102 | + python3 - > scan.log <<'EOF' |
| 103 | + import math |
| 104 | + print("NODE 0 0 0 0 0 0") |
| 105 | + for i in range(720): |
| 106 | + a = i * math.pi / 360 |
| 107 | + for j in range(20): |
| 108 | + r = 2 + j * 0.1 |
| 109 | + print(f"{r * math.cos(a):.4f} {r * math.sin(a):.4f} {(j - 10) * 0.05:.4f}") |
| 110 | + EOF |
| 111 | + # cmeel's patch gives the libraries an $ORIGIN RPATH but not the tools, as upstream ships them. |
| 112 | + export LD_LIBRARY_PATH="$prefix/lib" |
| 113 | + "$prefix/bin/log2graph" scan.log scan.graph |
| 114 | + "$prefix/bin/graph2tree" -i scan.graph -o tree.bt |
| 115 | + test -s tree.bt |
| 116 | +
|
| 117 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 118 | + with: |
| 119 | + name: cmeel-octomap-${{ env.CMEEL_OCTOMAP_VERSION }}-py3-none-manylinux_riscv64 |
| 120 | + path: wheelhouse/*.whl |
| 121 | + if-no-files-found: error |
| 122 | + |
| 123 | + publish: |
| 124 | + name: Publish cmeel-octomap ${{ matrix.version }} |
| 125 | + needs: [setup, build_wheels] |
| 126 | + if: needs.setup.outputs.versions != '[]' |
| 127 | + strategy: |
| 128 | + fail-fast: false |
| 129 | + matrix: |
| 130 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 131 | + permissions: |
| 132 | + contents: write |
| 133 | + pull-requests: write |
| 134 | + uses: $/.github/workflows/_publish-wheel.yml |
| 135 | + secrets: |
| 136 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 137 | + with: |
| 138 | + artifact-pattern: cmeel-octomap-${{ matrix.version }}-py3-none-manylinux_riscv64 |
0 commit comments