Skip to content

Commit 64b4e20

Browse files
authored
minijinja: add build-minijinja.yml for riscv64 wheels (#1235)
* **Package**: `minijinja` * **Version**: `2.24.0` * **Source**: https://github.com/mitsuhiko/minijinja * **Docs**: https://github.com/mitsuhiko/minijinja Compiles `minijinja-py`, the PyO3 bindings crate for MiniJinja, a Rust implementation of Jinja2 templating. Upstream publishes no riscv64 wheel. Mirrors the `linux` job of [upstream's `build-wheels.yml`](https://github.com/mitsuhiko/minijinja/blob/2.24.0/.github/workflows/build-wheels.yml). **Differs from upstream** - musllinux dropped - rustup ships no riscv64 musl toolchain. - Rust toolchain installed in-container rather than on the runner. **Matrix**: `cp38-abi3` (pyo3's `abi3-py38` feature is unconditional; built on cp39, the riscv64 image's floor, the same interpreter upstream's own workflow builds with despite the same cp38-abi3 tag) plus `cp314t`. **Testing** - same as upstream (pytest across `minijinja-py/tests`) **License**: OK Built on cp39-abi3 and cp314t; 46 passed on both (verified locally on both legs before pushing).
1 parent 632aa81 commit 64b4e20

1 file changed

Lines changed: 108 additions & 0 deletions

File tree

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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/mitsuhiko/minijinja/blob/2.24.0/.github/workflows/build-wheels.yml
6+
name: Build minijinja wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'minijinja version to build (git tag, e.g. 2.24.0)'
13+
required: true
14+
default: '2.24.0'
15+
pull_request:
16+
paths:
17+
- '.github/workflows/build-minijinja.yml'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.version || '2.24.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 2.24.0 there.
28+
MINIJINJA_VERSION: ${{ inputs.version || '2.24.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 minijinja ${{ inputs.version || '2.24.0' }} ${{ matrix.tag }}-manylinux_riscv64
38+
runs-on: ubuntu-24.04-riscv
39+
timeout-minutes: 90
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
include:
44+
# pyo3's abi3-py38 feature is on unconditionally (minijinja-py/Cargo.toml), so
45+
# one abi3 wheel serves every GIL-ful interpreter; pyo3 disables abi3 under
46+
# Py_GIL_DISABLED, giving the free-threaded build its own wheel (upstream's own
47+
# tests.yml runs a "freethreaded" variant of the Python binding test job).
48+
- tag: cp38-abi3
49+
# The riscv64 manylinux image ships no cp38 (cp39 is its floor), so build on
50+
# cp39 instead -- the oldest interpreter it has -- and re-test on the newer
51+
# ones via find_compatible_wheel. Upstream's own build-wheels.yml does the
52+
# same thing for the same reason: its linux job builds with
53+
# `--interpreter "3.9"` despite the crate's cp38-abi3 tag.
54+
build: >-
55+
cp39-manylinux_riscv64 cp310-manylinux_riscv64
56+
cp311-manylinux_riscv64 cp312-manylinux_riscv64
57+
cp313-manylinux_riscv64 cp314-manylinux_riscv64
58+
- tag: cp314t
59+
build: cp314t-manylinux_riscv64
60+
61+
steps:
62+
- name: Checkout minijinja ${{ env.MINIJINJA_VERSION }}
63+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
64+
with:
65+
repository: mitsuhiko/minijinja
66+
ref: ${{ env.MINIJINJA_VERSION }}
67+
persist-credentials: false
68+
69+
- name: Build wheels
70+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
71+
with:
72+
package-dir: minijinja-py
73+
output-dir: wheelhouse/
74+
env:
75+
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
76+
CIBW_BUILD: ${{ matrix.build }}
77+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
78+
# minijinja-py ships no [tool.cibuildwheel], so the Rust toolchain its
79+
# maturin backend needs is installed in-container here.
80+
CIBW_BEFORE_ALL_LINUX: >-
81+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
82+
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin"
83+
CIBW_TEST_REQUIRES: pytest
84+
CIBW_TEST_SOURCES: minijinja-py/tests minijinja-py/pyproject.toml
85+
# test_load_from_path resolves "tests/templates" relative to cwd, so pytest
86+
# must run from minijinja-py/ (matching upstream's own Makefile) rather than
87+
# the staged test_cwd root.
88+
CIBW_TEST_COMMAND: >-
89+
python -c "import minijinja._lowlevel as m, importlib.metadata as md;
90+
assert m.__file__.endswith('.so'), m.__file__;
91+
assert any(str(p).endswith('licenses/LICENSE') for p in md.files('minijinja'))" &&
92+
cd minijinja-py && python -m pytest -v tests
93+
94+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
95+
with:
96+
name: minijinja-${{ env.MINIJINJA_VERSION }}-${{ matrix.tag }}-manylinux_riscv64
97+
path: wheelhouse/*.whl
98+
if-no-files-found: error
99+
100+
publish:
101+
name: Publish minijinja ${{ inputs.version || '2.24.0' }}
102+
needs: [setup, build_wheels]
103+
permissions:
104+
contents: write
105+
pull-requests: write
106+
uses: $/.github/workflows/_publish-wheel.yml
107+
with:
108+
artifact-pattern: minijinja-${{ inputs.version || '2.24.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)