|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the `linux` job of |
| 5 | +# https://github.com/baseplate-admin/resvg-py/blob/0.5.0/.github/workflows/CI.yaml |
| 6 | +name: Build resvg-py wheels (riscv64) |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'resvg-py version to build (git tag, e.g. 0.5.0)' |
| 13 | + required: true |
| 14 | + default: '0.5.0' |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-resvg-py.yml' |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ inputs.version || '0.5.0' }}-${{ github.head_ref || github.run_id }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read # to fetch code (actions/checkout) |
| 25 | + |
| 26 | +env: |
| 27 | + # `inputs.version` is empty on pull_request events; default to 0.5.0 there. |
| 28 | + RESVG_PY_VERSION: ${{ inputs.version || '0.5.0' }} |
| 29 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 30 | + |
| 31 | +jobs: |
| 32 | + setup: |
| 33 | + uses: $/.github/workflows/_setup.yml |
| 34 | + |
| 35 | + build_wheels: |
| 36 | + needs: [setup] |
| 37 | + name: Build resvg-py ${{ inputs.version || '0.5.0' }} ${{ matrix.tag }}-manylinux_riscv64 |
| 38 | + runs-on: ubuntu-24.04-riscv |
| 39 | + timeout-minutes: 60 |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + include: |
| 44 | + # Cargo.toml enables pyo3's abi3-py310 and abi3t-py315 unconditionally, |
| 45 | + # so one abi3 wheel serves every GIL-ful interpreter from cp310; pyo3 |
| 46 | + # disables plain abi3 under Py_GIL_DISABLED, so cp314t gets its own |
| 47 | + # per-interpreter wheel; and abi3t-py315 gives cp315t+ a forward-compatible |
| 48 | + # cp315-abi3.abi3t wheel -- matching the exact three-wheel split |
| 49 | + # upstream publishes to PyPI. |
| 50 | + - tag: cp310-abi3 |
| 51 | + build: >- |
| 52 | + cp310-manylinux_riscv64 cp311-manylinux_riscv64 |
| 53 | + cp312-manylinux_riscv64 cp313-manylinux_riscv64 |
| 54 | + cp314-manylinux_riscv64 |
| 55 | + - tag: cp314t |
| 56 | + build: cp314t-manylinux_riscv64 |
| 57 | + - tag: cp315t |
| 58 | + build: cp315t-manylinux_riscv64 |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Checkout resvg-py ${{ env.RESVG_PY_VERSION }} |
| 62 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 63 | + with: |
| 64 | + repository: baseplate-admin/resvg-py |
| 65 | + ref: ${{ env.RESVG_PY_VERSION }} |
| 66 | + persist-credentials: false |
| 67 | + |
| 68 | + - name: Build and test wheel |
| 69 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 70 | + with: |
| 71 | + output-dir: wheelhouse/ |
| 72 | + env: |
| 73 | + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. |
| 74 | + CIBW_BUILD: ${{ matrix.build }} |
| 75 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 76 | + # resvg-py ships no [tool.cibuildwheel], so the Rust toolchain its |
| 77 | + # maturin backend needs is installed in-container here. |
| 78 | + CIBW_BEFORE_ALL_LINUX: >- |
| 79 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 80 | + CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" |
| 81 | + CIBW_TEST_REQUIRES: pytest pyperclip |
| 82 | + CIBW_TEST_SOURCES: tests |
| 83 | + CIBW_TEST_COMMAND: >- |
| 84 | + python -c "import resvg_py.resvg_py as m, importlib.metadata as md; |
| 85 | + assert m.__file__.endswith('.so'), m.__file__; |
| 86 | + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('resvg_py'))" && |
| 87 | + python -m pytest -v tests |
| 88 | +
|
| 89 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 90 | + with: |
| 91 | + name: resvg-py-${{ env.RESVG_PY_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 |
| 92 | + path: wheelhouse/*.whl |
| 93 | + if-no-files-found: error |
| 94 | + |
| 95 | + publish: |
| 96 | + name: Publish resvg-py ${{ inputs.version || '0.5.0' }} |
| 97 | + needs: [setup, build_wheels] |
| 98 | + permissions: |
| 99 | + contents: write |
| 100 | + pull-requests: write |
| 101 | + uses: $/.github/workflows/_publish-wheel.yml |
| 102 | + with: |
| 103 | + artifact-pattern: resvg-py-${{ inputs.version || '0.5.0' }}-*-manylinux_riscv64 |
0 commit comments