Skip to content

Commit 0bb62bb

Browse files
authored
pqcrypto: add build-pqcrypto.yml for riscv64 wheels (#1484)
* **Package**: `pqcrypto` * **Version**: `1.0.0` * **Source**: https://github.com/backbone-hq/pqcrypto * **Docs**: https://github.com/backbone-hq/pqcrypto Builds a Rust/PyO3 extension for post-quantum crypto (ML-KEM, ML-DSA, SLH-DSA, Classic McEliece, HQC, SNTRUP). Upstream publishes no riscv64 wheel. Mirrors the `build-linux` job of [upstream's `ci.yml`](https://github.com/backbone-hq/pqcrypto/blob/v1.0.0/.github/workflows/ci.yml). **Differs from upstream** - No cp314t job - Cargo.toml enables pyo3's `abi3-py39` feature unconditionally and upstream ships no free-threaded wheel either. **Testing** - same as upstream **License**: OK - Apache-2.0, no vendored third-party sources; all algorithm crates are pure safe Rust with no bundled C/asm. Built on cp312 (reused/tested on cp313, cp314).
1 parent 5e69700 commit 0bb62bb

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `build-linux` job of
5+
# https://github.com/backbone-hq/pqcrypto/blob/v1.0.0/.github/workflows/ci.yml
6+
name: Build pqcrypto wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'pqcrypto version to build (git tag without leading v, e.g. 1.0.0)'
13+
required: true
14+
default: '1.0.0'
15+
pull_request:
16+
paths:
17+
- '.github/workflows/build-pqcrypto.yml'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.version || '1.0.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 1.0.0 there.
28+
PQCRYPTO_VERSION: ${{ inputs.version || '1.0.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 pqcrypto ${{ inputs.version || '1.0.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-py39 feature is on unconditionally (Cargo.toml), so one
45+
# abi3 wheel serves every interpreter it claims. Upstream itself builds
46+
# its manylinux wheel against Python 3.12 (ci.yml build-linux image),
47+
# and ships no free-threaded (cp314t) wheel, so there is no second job
48+
# here -- pyo3 disables abi3 under Py_GIL_DISABLED and this crate has
49+
# no non-abi3 build path.
50+
- tag: cp39-abi3
51+
build: >-
52+
cp312-manylinux_riscv64 cp313-manylinux_riscv64
53+
cp314-manylinux_riscv64
54+
55+
steps:
56+
- name: Checkout pqcrypto v${{ env.PQCRYPTO_VERSION }}
57+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
58+
with:
59+
repository: backbone-hq/pqcrypto
60+
ref: v${{ env.PQCRYPTO_VERSION }}
61+
persist-credentials: false
62+
63+
- name: Build wheels
64+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
65+
with:
66+
output-dir: wheelhouse/
67+
env:
68+
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
69+
CIBW_BUILD: ${{ matrix.build }}
70+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
71+
# No [tool.cibuildwheel] upstream, so the Rust toolchain its maturin
72+
# backend needs is installed in-container here.
73+
CIBW_BEFORE_ALL_LINUX: >-
74+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
75+
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin"
76+
CIBW_TEST_REQUIRES: pytest
77+
CIBW_TEST_SOURCES: tests
78+
CIBW_TEST_COMMAND: python -m pytest -q tests
79+
80+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
81+
with:
82+
name: pqcrypto-${{ env.PQCRYPTO_VERSION }}-${{ matrix.tag }}-manylinux_riscv64
83+
path: wheelhouse/*.whl
84+
if-no-files-found: error
85+
86+
publish:
87+
name: Publish pqcrypto ${{ inputs.version || '1.0.0' }}
88+
needs: [setup, build_wheels]
89+
permissions:
90+
contents: write
91+
pull-requests: write
92+
uses: $/.github/workflows/_publish-wheel.yml
93+
with:
94+
artifact-pattern: pqcrypto-${{ inputs.version || '1.0.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)