Skip to content

Commit beb8eee

Browse files
authored
markdown-it-pyrs: add build-markdown-it-pyrs.yml for riscv64 wheels (#1382)
* **Package**: `markdown-it-pyrs` * **Version**: `0.4.0` * **Source**: https://github.com/chrisjsewell/markdown-it-pyrs * **Docs**: https://github.com/chrisjsewell/markdown-it-pyrs Compiles the PyO3 binding for `markdown-it.rs`, a CommonMark/GFM Markdown parser. Upstream publishes no riscv64 wheel. Mirrors the `linux` job of [upstream's `CI.yml`](https://github.com/chrisjsewell/markdown-it-pyrs/blob/v0.4.0/.github/workflows/CI.yml), via cibuildwheel instead of `maturin-action` directly. **Differs from upstream** - musllinux dropped - rustup ships no riscv64 musl toolchain. **Matrix**: cp312/cp313 only - pyo3 0.19.2 sets no abi3 feature, predates `Py_GIL_DISABLED` (no cp314t), and segfaults on `.render()` against cp314's changed Unicode object layout (no cp314). **Testing** - runs `test_api.py`/`test_cli.py`/`test_fixtures.py`; `bench_html.py`/`bench_tree.py` need the unrelated benchmarking extra, deselected. **License**: OK Built on cp312.
1 parent 9117f45 commit beb8eee

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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/chrisjsewell/markdown-it-pyrs/blob/v0.4.0/.github/workflows/CI.yml
6+
name: Build markdown-it-pyrs wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'markdown-it-pyrs version to build (git tag without leading v, e.g. 0.4.0)'
13+
required: true
14+
default: '0.4.0'
15+
pull_request:
16+
paths:
17+
- '.github/workflows/build-markdown-it-pyrs.yml'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.version || '0.4.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.4.0 there.
28+
MARKDOWN_IT_PYRS_VERSION: ${{ inputs.version || '0.4.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 markdown-it-pyrs ${{ inputs.version || '0.4.0' }} ${{ matrix.python }}-manylinux_riscv64
38+
runs-on: ubuntu-24.04-riscv
39+
timeout-minutes: 60
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
# pyo3 0.19.2 sets no abi3 feature, so every interpreter needs its own
44+
# build. cp314 segfaults on the first .render() call - pyo3 0.19.2
45+
# predates CPython 3.14's changed Unicode object layout (gotcha 322) -
46+
# and it also predates Py_GIL_DISABLED entirely, so cp314t is dropped
47+
# too.
48+
python: ["cp312", "cp313"]
49+
50+
steps:
51+
- name: Checkout markdown-it-pyrs v${{ env.MARKDOWN_IT_PYRS_VERSION }}
52+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53+
with:
54+
repository: chrisjsewell/markdown-it-pyrs
55+
ref: v${{ env.MARKDOWN_IT_PYRS_VERSION }}
56+
persist-credentials: false
57+
58+
- name: Build and test wheel
59+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
60+
with:
61+
output-dir: wheelhouse/
62+
env:
63+
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
64+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
65+
# markdown-it-pyrs ships no [tool.cibuildwheel], so the Rust
66+
# toolchain its maturin backend needs is installed in-container here.
67+
CIBW_BEFORE_ALL_LINUX: >-
68+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
69+
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin"
70+
CIBW_TEST_REQUIRES: pytest pytest-param-files
71+
CIBW_TEST_SOURCES: tests
72+
# bench_html.py/bench_tree.py need the benchmarking extra
73+
# (pytest-benchmark, markdown-it-py), not relevant to a wheel test.
74+
CIBW_TEST_COMMAND: >-
75+
python -c "import markdown_it_pyrs.markdown_it_pyrs as m; assert m.__file__.endswith('.so'), m.__file__" &&
76+
python -m pytest -v tests/test_api.py tests/test_cli.py tests/test_fixtures.py
77+
78+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
79+
with:
80+
name: markdown-it-pyrs-${{ env.MARKDOWN_IT_PYRS_VERSION }}-${{ matrix.python }}-manylinux_riscv64
81+
path: wheelhouse/*.whl
82+
if-no-files-found: error
83+
84+
publish:
85+
name: Publish markdown-it-pyrs ${{ inputs.version || '0.4.0' }}
86+
needs: [setup, build_wheels]
87+
permissions:
88+
contents: write
89+
pull-requests: write
90+
uses: $/.github/workflows/_publish-wheel.yml
91+
with:
92+
artifact-pattern: markdown-it-pyrs-${{ inputs.version || '0.4.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)