|
| 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/shazamio/shazamio-core/blob/1.2.0/.github/workflows/ci.yaml |
| 6 | +name: Build shazamio-core 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/shazamio-core.yaml not released yet' |
| 13 | + required: false |
| 14 | + default: '' |
| 15 | + pull_request: |
| 16 | + branches: [main] |
| 17 | + paths: |
| 18 | + - '.github/workflows/build-shazamio-core.yml' |
| 19 | + - 'docs/packages/shazamio-core.yaml' |
| 20 | + push: |
| 21 | + branches: [main] |
| 22 | + paths: |
| 23 | + - '.github/workflows/build-shazamio-core.yml' |
| 24 | + - 'docs/packages/shazamio-core.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 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 35 | + |
| 36 | +jobs: |
| 37 | + setup: |
| 38 | + uses: $/.github/workflows/_setup.yml |
| 39 | + with: |
| 40 | + package: shazamio-core |
| 41 | + version: ${{ inputs.version }} |
| 42 | + |
| 43 | + build_wheels: |
| 44 | + needs: [setup] |
| 45 | + if: needs.setup.outputs.versions != '[]' |
| 46 | + name: Build shazamio-core ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 |
| 47 | + runs-on: ubuntu-24.04-riscv |
| 48 | + timeout-minutes: 120 |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 53 | + include: |
| 54 | + # pyo3's abi3-py310 feature is on unconditionally, so one abi3 wheel |
| 55 | + # serves every GIL-ful interpreter; upstream builds no free-threaded |
| 56 | + # wheel (no gil_used declared), so there is no second tag. |
| 57 | + - tag: cp310-abi3 |
| 58 | + # Built on cp310 -- the oldest interpreter the abi3 tag claims -- |
| 59 | + # and re-tested on the newer ones via find_compatible_wheel. |
| 60 | + build: >- |
| 61 | + cp310-manylinux_riscv64 cp311-manylinux_riscv64 |
| 62 | + cp312-manylinux_riscv64 cp313-manylinux_riscv64 |
| 63 | + cp314-manylinux_riscv64 |
| 64 | +
|
| 65 | + env: |
| 66 | + SHAZAMIO_CORE_VERSION: ${{ matrix.version }} |
| 67 | + |
| 68 | + steps: |
| 69 | + - name: Checkout shazamio-core ${{ env.SHAZAMIO_CORE_VERSION }} |
| 70 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 71 | + with: |
| 72 | + repository: shazamio/shazamio-core |
| 73 | + ref: ${{ env.SHAZAMIO_CORE_VERSION }} |
| 74 | + persist-credentials: false |
| 75 | + |
| 76 | + - name: Build wheels |
| 77 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 78 | + with: |
| 79 | + output-dir: wheelhouse/ |
| 80 | + env: |
| 81 | + CIBW_BUILD: ${{ matrix.build }} |
| 82 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 83 | + # shazamio-core ships no [tool.cibuildwheel], so the Rust toolchain |
| 84 | + # its maturin backend needs is installed in-container here. |
| 85 | + CIBW_BEFORE_ALL_LINUX: >- |
| 86 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 87 | + CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" |
| 88 | + # Mirror upstream's own `test` job (pip install . pytest pytest-asyncio |
| 89 | + # && pytest). |
| 90 | + CIBW_TEST_REQUIRES: pytest pytest-asyncio |
| 91 | + CIBW_TEST_COMMAND: pytest {package}/tests -v |
| 92 | + |
| 93 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 94 | + with: |
| 95 | + name: shazamio-core-${{ env.SHAZAMIO_CORE_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 |
| 96 | + path: wheelhouse/*.whl |
| 97 | + if-no-files-found: error |
| 98 | + |
| 99 | + publish: |
| 100 | + name: Publish shazamio-core ${{ matrix.version }} |
| 101 | + needs: [setup, build_wheels] |
| 102 | + if: needs.setup.outputs.versions != '[]' |
| 103 | + strategy: |
| 104 | + fail-fast: false |
| 105 | + matrix: |
| 106 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 107 | + permissions: |
| 108 | + contents: write |
| 109 | + pull-requests: write |
| 110 | + uses: $/.github/workflows/_publish-wheel.yml |
| 111 | + secrets: |
| 112 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 113 | + with: |
| 114 | + artifact-pattern: shazamio-core-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments