Skip to content

workflows: migrate canonical cibuildwheel builds #148

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #148

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `build` and `build-free-threaded` jobs of
# https://github.com/jxxghp/MoviePilot-Rust/blob/v0.3.8/.github/workflows/release.yml
# and on the `test` job of
# https://github.com/jxxghp/MoviePilot-Rust/blob/v0.3.8/.github/workflows/ci.yml
name: Build moviepilot-rust wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/moviepilot-rust.yaml not released yet'
required: false
default: ''
cancel-in-progress:
description: Cancel an in-progress run in the same concurrency group.
required: false
type: boolean
default: true
pull_request:
branches: [main]
paths:
- '.github/workflows/build-moviepilot-rust.yml'
- 'docs/packages/moviepilot-rust.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-moviepilot-rust.yml'
- 'docs/packages/moviepilot-rust.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ case(github.event_name == 'pull_request', true, github.event_name == 'workflow_dispatch', inputs['cancel-in-progress'], false) }}
permissions:
contents: read # to fetch code (actions/checkout)
env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: moviepilot-rust
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build moviepilot-rust ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.setup.outputs.matrix) }}
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "moviepilot-rust"
version: "${{ matrix.version }}"
repository: "jxxghp/MoviePilot-Rust"
ref: "v${{ matrix.version }}"
artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64"
timeout-minutes: 90
cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64"
cibw-musllinux-riscv64-image: "quay.io/pypa/musllinux_1_2_riscv64"
cibw-before-all-linux: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
cibw-environment-linux: "PATH=\"$PATH:$HOME/.cargo/bin\" ${{ case(matrix.python == 'cp314', 'PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1', endsWith(matrix.python, 't'), 'MATURIN_PEP517_ARGS=\"--locked --no-default-features --features zhconv\"', '') }}"
cibw-test-requires: "pytest"
cibw-test-sources: "tests"
cibw-test-command: "python -m pytest -q"
gpl_sources:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Collect GPL sources
runs-on: ubuntu-24.04-riscv
env:
MOVIEPILOT_RUST_VERSION: ${{ matrix.version }}
steps:
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Rust cdylibs on musl link libgcc_s dynamically, so auditwheel vendors it into the musllinux wheels.
- uses: ./actions/collect-gpl-sources
with:
image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
packages: gcc
output: gpl-sources.tar
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: moviepilot-rust-${{ env.MOVIEPILOT_RUST_VERSION }}-gpl-sources
path: gpl-sources.tar
if-no-files-found: error
publish:
name: Publish moviepilot-rust ${{ matrix.version }}
needs: [setup, build_wheels, gpl_sources]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: moviepilot-rust-${{ matrix.version }}-*_riscv64
gpl-sources-artifact: moviepilot-rust-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc