Skip to content

workflows: migrate canonical cibuildwheel builds #362

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #362

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `python-wheels` job of
# https://github.com/xberg-io/html-to-markdown/blob/v3.12.0/.github/workflows/publish.yaml
name: Build html-to-markdown wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/html-to-markdown.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-html-to-markdown.yml'
- 'docs/packages/html-to-markdown.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-html-to-markdown.yml'
- 'docs/packages/html-to-markdown.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
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: html-to-markdown
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build html-to-markdown ${{ matrix.version }} cp310-abi3-manylinux_riscv64
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "html-to-markdown"
version: "${{ matrix.version }}"
repository: "xberg-io/html-to-markdown"
ref: "v${{ matrix.version }}"
artifact-tag: "cp310-abi3-manylinux_riscv64"
timeout-minutes: 180
cibw-package-dir: "packages/python"
# abi3-py310 is baked unconditionally into packages/python/pyproject.toml's
# [tool.maturin] features, so one wheel serves every interpreter below;
# there is no free-threaded build (pyo3 abi3 can't target Py_GIL_DISABLED,
# and upstream itself ships no cp314t wheel).
cibw-build: >
cp310-manylinux_riscv64 cp311-manylinux_riscv64
cp312-manylinux_riscv64 cp313-manylinux_riscv64
cp314-manylinux_riscv64
# html-to-markdown ships no [tool.cibuildwheel]; the Rust toolchain its
# maturin backend needs is installed in-container here, same as upstream's
# own cibw-before-build-linux (publish.yaml's python-wheels job).
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\""
# Mirrors scripts/prepare_wheel.py, which upstream's own before-build also
# runs: it cargo-builds the standalone CLI binary and bundles it into
# html_to_markdown/bin and the wheel's .data/scripts before maturin builds
# the extension module.
cibw-before-build-linux: >
pip install maturin uv &&
python scripts/prepare_wheel.py
cibw-test-requires: "pytest pytest-asyncio pytest-timeout"
cibw-test-sources: >
e2e/python/conftest.py e2e/python/pyproject.toml e2e/python/tests
# test_options_preprocessing_{aggressive,minimal} raise
# NameError: name 'PreprocessingPreset' is not defined at v3.12.0: the
# test module's import line omits PreprocessingPreset even though it's
# used later in the file and is exported by html_to_markdown.__init__;
# upstream's main branch already carries the fixed import, just not yet
# in a tagged release. Fails identically on every architecture.
cibw-test-command: >
python -c "import html_to_markdown._html_to_markdown as m;
assert m.__file__.endswith('.so'), m.__file__" &&
python -m pytest -v e2e/python/tests
-k "not test_options_preprocessing_aggressive and not test_options_preprocessing_minimal"
publish:
name: Publish html-to-markdown ${{ matrix.version }}
needs: [setup, build_wheels]
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: html-to-markdown-${{ matrix.version }}-*-manylinux_riscv64