|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the `.linux-cibuildwheel` job of |
| 5 | +# https://gitlab.com/sdurobotics/ur_rtde/-/blob/master/ci/gitlab-ci-linux.yml |
| 6 | +name: Build ur-rtde wheels (riscv64) |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/ur-rtde.yaml not released yet' |
| 13 | + required: false |
| 14 | + default: '' |
| 15 | + pull_request: |
| 16 | + branches: [main] |
| 17 | + paths: |
| 18 | + - '.github/workflows/build-ur-rtde.yml' |
| 19 | + - 'docs/packages/ur-rtde.yaml' |
| 20 | + push: |
| 21 | + branches: [main] |
| 22 | + paths: |
| 23 | + - '.github/workflows/build-ur-rtde.yml' |
| 24 | + - 'docs/packages/ur-rtde.yaml' |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: read # to fetch code (actions/checkout) |
| 32 | + |
| 33 | +env: |
| 34 | + # Upstream stopped pushing tags after v1.6.0, so pin the release commit: |
| 35 | + # "Release [1.6.5]", whose tree is byte-identical to the 1.6.5 PyPI sdist. |
| 36 | + # Update it alongside UR_RTDE_VERSION. |
| 37 | + UR_RTDE_REF: 3ce20df094ca9d629875862b8e3c361c4833f7e1 |
| 38 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 39 | + |
| 40 | +jobs: |
| 41 | + setup: |
| 42 | + uses: $/.github/workflows/_setup.yml |
| 43 | + with: |
| 44 | + package: ur-rtde |
| 45 | + version: ${{ inputs.version }} |
| 46 | + |
| 47 | + build_wheels: |
| 48 | + needs: [setup] |
| 49 | + if: needs.setup.outputs.versions != '[]' |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 54 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 55 | + name: Build ur-rtde ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 56 | + runs-on: ubuntu-24.04-riscv |
| 57 | + timeout-minutes: 120 |
| 58 | + |
| 59 | + env: |
| 60 | + UR_RTDE_VERSION: ${{ matrix.version }} |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Checkout ur_rtde ${{ env.UR_RTDE_VERSION }} |
| 64 | + run: | |
| 65 | + set -euo pipefail |
| 66 | + git init -q . |
| 67 | + git remote add origin https://gitlab.com/sdurobotics/ur_rtde.git |
| 68 | + git fetch -q --depth 1 origin "$UR_RTDE_REF" |
| 69 | + git checkout -q FETCH_HEAD |
| 70 | + git submodule update --init --depth 1 |
| 71 | +
|
| 72 | + # Upstream ships no Python tests (its doctest suite needs a URSim |
| 73 | + # container), so drive DashboardClient's Boost.Asio client against a |
| 74 | + # fake dashboard server and check the RTDE modules load. |
| 75 | + - name: Write wheel test |
| 76 | + run: | |
| 77 | + cat > riscv64_test_ur_rtde.py <<'EOF' |
| 78 | + import socket |
| 79 | + import threading |
| 80 | +
|
| 81 | + import dashboard_client |
| 82 | + import rtde_control |
| 83 | + import rtde_io |
| 84 | + import rtde_receive |
| 85 | + import script_client |
| 86 | +
|
| 87 | + REPLIES = { |
| 88 | + "PolyscopeVersion": "URSoftware 5.11.1.108318 (Mar 22 2021)", |
| 89 | + "robotmode": "Robotmode: IDLE", |
| 90 | + "get robot model": "UR5", |
| 91 | + "programState": "STOPPED <unnamed>", |
| 92 | + } |
| 93 | +
|
| 94 | + srv = socket.socket() |
| 95 | + srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
| 96 | + srv.bind(("127.0.0.1", 0)) |
| 97 | + srv.listen(1) |
| 98 | + port = srv.getsockname()[1] |
| 99 | + seen = [] |
| 100 | +
|
| 101 | +
|
| 102 | + def serve(): |
| 103 | + conn, _ = srv.accept() |
| 104 | + with conn, conn.makefile("rw", newline="\n") as f: |
| 105 | + f.write("Connected: Universal Robots Dashboard Server\n") |
| 106 | + f.flush() |
| 107 | + for line in f: |
| 108 | + cmd = line.rstrip("\n") |
| 109 | + seen.append(cmd) |
| 110 | + f.write(REPLIES.get(cmd, "could not understand: '%s'" % cmd) + "\n") |
| 111 | + f.flush() |
| 112 | +
|
| 113 | +
|
| 114 | + t = threading.Thread(target=serve, daemon=True) |
| 115 | + t.start() |
| 116 | +
|
| 117 | + for mod, cls in [ |
| 118 | + (rtde_control, "RTDEControlInterface"), |
| 119 | + (rtde_receive, "RTDEReceiveInterface"), |
| 120 | + (rtde_io, "RTDEIOInterface"), |
| 121 | + (script_client, "ScriptClient"), |
| 122 | + (dashboard_client, "DashboardClient"), |
| 123 | + ]: |
| 124 | + assert hasattr(mod, cls), (mod, cls) |
| 125 | +
|
| 126 | + dc = dashboard_client.DashboardClient("127.0.0.1", port) |
| 127 | + assert not dc.isConnected() |
| 128 | + dc.connect() |
| 129 | + assert dc.isConnected() |
| 130 | + assert dc.polyscopeVersion() == "5.11.1.108318", "version" |
| 131 | + assert dc.robotmode() == "Robotmode: IDLE" |
| 132 | + assert dc.getRobotModel() == "UR5" |
| 133 | + assert dc.programState() == "STOPPED <unnamed>" |
| 134 | + dc.disconnect() |
| 135 | + assert not dc.isConnected() |
| 136 | + assert seen == ["PolyscopeVersion", "robotmode", "get robot model", "programState"], seen |
| 137 | +
|
| 138 | + try: |
| 139 | + dashboard_client.DashboardClient("127.0.0.1", 1).connect(500) |
| 140 | + except RuntimeError as e: |
| 141 | + print("refused as expected:", e) |
| 142 | + else: |
| 143 | + raise AssertionError("connect to a closed port succeeded") |
| 144 | + print("ur_rtde OK") |
| 145 | + EOF |
| 146 | +
|
| 147 | + - name: Build wheel |
| 148 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 149 | + with: |
| 150 | + output-dir: wheelhouse |
| 151 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 152 | + env: |
| 153 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 154 | + # Upstream's ci/build-boost.sh builds Boost 1.68, which ships no |
| 155 | + # BoostConfig.cmake; with the image's CMake >= 3.30 the project's own |
| 156 | + # cmake_policy(SET CMP0167 NEW) then requires one, so use the distro Boost. |
| 157 | + CIBW_BEFORE_ALL_LINUX: yum install -y boost-devel |
| 158 | + CIBW_TEST_SOURCES: riscv64_test_ur_rtde.py |
| 159 | + CIBW_TEST_COMMAND: python riscv64_test_ur_rtde.py |
| 160 | + |
| 161 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 162 | + with: |
| 163 | + name: ur-rtde-${{ env.UR_RTDE_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 164 | + path: wheelhouse/*.whl |
| 165 | + if-no-files-found: error |
| 166 | + |
| 167 | + publish: |
| 168 | + name: Publish ur-rtde ${{ matrix.version }} |
| 169 | + needs: [setup, build_wheels] |
| 170 | + if: needs.setup.outputs.versions != '[]' |
| 171 | + strategy: |
| 172 | + fail-fast: false |
| 173 | + matrix: |
| 174 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 175 | + permissions: |
| 176 | + contents: write |
| 177 | + pull-requests: write |
| 178 | + uses: $/.github/workflows/_publish-wheel.yml |
| 179 | + secrets: |
| 180 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 181 | + with: |
| 182 | + artifact-pattern: ur-rtde-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments