|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the `python_sdist` and `wheel_linux` jobs of |
| 5 | +# https://github.com/oxigraph/oxigraph/blob/v0.5.11/.github/workflows/artifacts.yml |
| 6 | +# and the `python` job of |
| 7 | +# https://github.com/oxigraph/oxigraph/blob/v0.5.11/.github/workflows/tests.yml |
| 8 | +name: Build pyoxigraph 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/pyoxigraph.yaml not released yet' |
| 15 | + required: false |
| 16 | + default: '' |
| 17 | + pull_request: |
| 18 | + branches: [main] |
| 19 | + paths: |
| 20 | + - '.github/workflows/build-pyoxigraph.yml' |
| 21 | + - 'docs/packages/pyoxigraph.yaml' |
| 22 | + push: |
| 23 | + branches: [main] |
| 24 | + paths: |
| 25 | + - '.github/workflows/build-pyoxigraph.yml' |
| 26 | + - 'docs/packages/pyoxigraph.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: pyoxigraph |
| 43 | + version: ${{ inputs.version }} |
| 44 | + |
| 45 | + stubs: |
| 46 | + needs: [setup] |
| 47 | + if: needs.setup.outputs.versions != '[]' |
| 48 | + name: Generate pyoxigraph ${{ matrix.version }} stubs |
| 49 | + runs-on: ubuntu-latest |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 54 | + |
| 55 | + env: |
| 56 | + PYOXIGRAPH_VERSION: ${{ matrix.version }} |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout oxigraph v${{ env.PYOXIGRAPH_VERSION }} |
| 60 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 61 | + with: |
| 62 | + repository: oxigraph/oxigraph |
| 63 | + ref: v${{ env.PYOXIGRAPH_VERSION }} |
| 64 | + submodules: true |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 |
| 68 | + with: |
| 69 | + python-version: '3.13' |
| 70 | + enable-cache: false |
| 71 | + |
| 72 | + - run: uv run --locked python generate_stubs.py pyoxigraph pyoxigraph.pyi --ruff |
| 73 | + working-directory: ./python |
| 74 | + |
| 75 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 76 | + with: |
| 77 | + name: pyoxigraph-${{ env.PYOXIGRAPH_VERSION }}-stubs |
| 78 | + path: python/pyoxigraph.pyi |
| 79 | + if-no-files-found: error |
| 80 | + |
| 81 | + build_wheels: |
| 82 | + needs: [setup, stubs] |
| 83 | + if: needs.setup.outputs.versions != '[]' |
| 84 | + name: Build pyoxigraph ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 85 | + runs-on: ubuntu-24.04-riscv |
| 86 | + timeout-minutes: 1440 |
| 87 | + strategy: |
| 88 | + fail-fast: false |
| 89 | + matrix: |
| 90 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 91 | + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. |
| 92 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 93 | + |
| 94 | + env: |
| 95 | + PYOXIGRAPH_VERSION: ${{ matrix.version }} |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Checkout oxigraph v${{ env.PYOXIGRAPH_VERSION }} |
| 99 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 100 | + with: |
| 101 | + repository: oxigraph/oxigraph |
| 102 | + ref: v${{ env.PYOXIGRAPH_VERSION }} |
| 103 | + submodules: true |
| 104 | + persist-credentials: false |
| 105 | + |
| 106 | + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 107 | + with: |
| 108 | + name: pyoxigraph-${{ env.PYOXIGRAPH_VERSION }}-stubs |
| 109 | + path: python |
| 110 | + |
| 111 | + # maturin only globs licence files next to python/pyproject.toml, so |
| 112 | + # upstream's wheels ship none, not even for the bundled RocksDB and lz4. |
| 113 | + - name: Copy licence files next to python/pyproject.toml |
| 114 | + run: | |
| 115 | + cp LICENSE-APACHE LICENSE-MIT python/ |
| 116 | + cp oxrocksdb-sys/rocksdb/LICENSE.Apache python/LICENSE.rocksdb |
| 117 | + cp oxrocksdb-sys/rocksdb/LICENSE.leveldb python/LICENSE.leveldb |
| 118 | + cp oxrocksdb-sys/lz4/lib/LICENSE python/LICENSE.lz4 |
| 119 | +
|
| 120 | + - name: Set swap space |
| 121 | + uses: pierotofy/set-swap-space@fc79b3f67fa8a838184ce84a674ca12238d2c761 # master |
| 122 | + with: |
| 123 | + swap-size-gb: 10 |
| 124 | + |
| 125 | + - name: Build wheel |
| 126 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 127 | + with: |
| 128 | + package-dir: python |
| 129 | + output-dir: wheelhouse/ |
| 130 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 131 | + env: |
| 132 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 133 | + CIBW_BEFORE_ALL_LINUX: >- |
| 134 | + dnf install -y clang && |
| 135 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | |
| 136 | + sh -s -- -y --profile minimal |
| 137 | + CIBW_ENVIRONMENT_LINUX: >- |
| 138 | + PATH="$PATH:$HOME/.cargo/bin" |
| 139 | + CARGO_BUILD_JOBS=2 |
| 140 | + CIBW_TEST_SOURCES: python/tests |
| 141 | + CIBW_TEST_COMMAND: >- |
| 142 | + python -c "import importlib.metadata as m, pyoxigraph.pyoxigraph as n; |
| 143 | + assert n.__file__.endswith('.so'), n.__file__; |
| 144 | + f = {p.name for p in m.files('pyoxigraph')}; |
| 145 | + assert {'__init__.pyi', 'LICENSE-APACHE', 'LICENSE-MIT', 'LICENSE.rocksdb', 'LICENSE.leveldb', 'LICENSE.lz4'} <= f, f" && |
| 146 | + python -m unittest discover -v -s python/tests |
| 147 | +
|
| 148 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 149 | + with: |
| 150 | + name: pyoxigraph-${{ env.PYOXIGRAPH_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 151 | + path: wheelhouse/*.whl |
| 152 | + if-no-files-found: error |
| 153 | + |
| 154 | + publish: |
| 155 | + name: Publish pyoxigraph ${{ matrix.version }} |
| 156 | + needs: [setup, build_wheels] |
| 157 | + if: needs.setup.outputs.versions != '[]' |
| 158 | + strategy: |
| 159 | + fail-fast: false |
| 160 | + matrix: |
| 161 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 162 | + permissions: |
| 163 | + contents: write |
| 164 | + pull-requests: write |
| 165 | + uses: $/.github/workflows/_publish-wheel.yml |
| 166 | + secrets: |
| 167 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 168 | + with: |
| 169 | + artifact-pattern: pyoxigraph-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments