diff --git a/.github/workflows/build-autobahn.yml b/.github/workflows/build-autobahn.yml new file mode 100644 index 000000000..f47f51d8c --- /dev/null +++ b/.github/workflows/build-autobahn.yml @@ -0,0 +1,111 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +name: Build autobahn wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'autobahn version to build (git tag without leading v, e.g. 26.7.1)' + required: true + default: '26.7.1' + pull_request: + paths: + - '.github/workflows/build-autobahn.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '26.7.1' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # `inputs.version` is empty on pull_request events; default to 26.7.1 there. + AUTOBAHN_VERSION: ${{ inputs.version || '26.7.1' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build autobahn ${{ inputs.version || '26.7.1' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: + # Upstream doesn't build 3.14t yet, so skip it for now (matches + # build-fastuuid.yml's own reasoning). + python: ["cp312", "cp313", "cp314"] + + steps: + - name: Checkout autobahn v${{ env.AUTOBAHN_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: crossbario/autobahn-python + ref: v${{ env.AUTOBAHN_VERSION }} + persist-credentials: false + # deps/flatbuffers (used only to bundle the optional, non-gating + # `flatc` dev-convenience binary) is intentionally left uninitialized: + # hatch_build.py already treats a missing submodule as a supported + # configuration (same as building from the PyPI sdist, which never + # includes it either) and skips flatc without failing the build. + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # cffi, needed both to build and to import the NVX extension, has no + # riscv64 wheel on public PyPI; AUTOBAHN_USE_NVX=1 makes hatch_build.py + # fail the build (instead of silently degrading to a pure-Python + # wheel) if the CFFI compile doesn't succeed. + CIBW_ENVIRONMENT: >- + AUTOBAHN_USE_NVX=1 + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + # pynacl and argon2-cffi-bindings (encryption/scram extras) are + # compiled deps that also need the riseproject.dev index above. + CIBW_TEST_REQUIRES: pytest pytest-asyncio + CIBW_TEST_EXTRAS: encryption,scram,serialization + # Test the installed wheel via --pyargs (not the checkout) so a + # packaging mistake can't hide behind the source tree; excludes + # autobahn.twisted, matching upstream's own `just test-asyncio`. + # USE_ASYNCIO=1 picks the asyncio txaio backend (autobahn/wamp/test + # otherwise raises at import time). autobahn.asyncio.test has no + # __init__.py by upstream design (so trial won't also collect it + # for the twisted suite - see its README_NO_INIT_PY), so --pyargs + # can't reach it; locate it via the installed module and run it as + # a plain path instead. test_asyncio_component[_404] call the + # pre-3.14 fallback of asyncio.get_event_loop() (create a loop when + # none is running); CPython 3.14 removed that fallback and the + # calls now raise RuntimeError outside a running loop - an upstream + # bug on every platform, not a riscv64 issue. + CIBW_TEST_COMMAND: >- + USE_ASYNCIO=1 python -m pytest -v --pyargs + autobahn.test autobahn.nvx.test autobahn.rawsocket.test + autobahn.wamp.test autobahn.websocket.test + -k "not test_asyncio_component" + && USE_ASYNCIO=1 python -m pytest -v + "$(python -c "import os,autobahn.asyncio as m; print(os.path.join(os.path.dirname(m.__file__), \"test\"))")" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: autobahn-${{ env.AUTOBAHN_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish autobahn ${{ inputs.version || '26.7.1' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: autobahn-${{ inputs.version || '26.7.1' }}-*-manylinux_riscv64