Skip to content

pyheck: add build-pyheck.yml for riscv64 wheels #1

pyheck: add build-pyheck.yml for riscv64 wheels

pyheck: add build-pyheck.yml for riscv64 wheels #1

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `linux` job of
# https://github.com/kevinheavey/pyheck/blob/0.1.5/.github/workflows/build.yml
name: Build pyheck wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'pyheck version to build (git tag, e.g. 0.1.5)'
required: true
default: '0.1.5'
pull_request:
paths:
- '.github/workflows/build-pyheck.yml'
concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '0.1.5' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
# `inputs.version` is empty on pull_request events; default to 0.1.5 there.
PYHECK_VERSION: ${{ inputs.version || '0.1.5' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
build_wheels:
needs: [setup]
name: Build pyheck ${{ inputs.version || '0.1.5' }} cp37-abi3-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
steps:
- name: Checkout pyheck ${{ env.PYHECK_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: kevinheavey/pyheck
ref: ${{ env.PYHECK_VERSION }}
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
env:
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
# pyo3's abi3-py37 feature is on unconditionally (Cargo.toml), so
# one abi3 wheel serves every interpreter in our matrix; pyo3
# 0.15.1 predates PEP 703 entirely, so there is no free-threaded
# (cp314t) job.
CIBW_BUILD: >-
cp312-manylinux_riscv64 cp313-manylinux_riscv64
cp314-manylinux_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# pyheck ships no [tool.cibuildwheel], so the Rust toolchain its
# maturin backend needs is installed in-container here.
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"
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_SOURCES: tests
CIBW_TEST_COMMAND: >-
python -c "import pyheck; assert pyheck.pyheck.__file__.endswith('.abi3.so'), pyheck.pyheck.__file__" &&
python -m pytest -v tests
- name: Check the licence made it into the wheel
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
for whl in sys.argv[1:]:
names = zipfile.ZipFile(whl).namelist()
# pyproject.toml pins maturin<0.13, which predates PEP 639 and
# uses dist-info/license_files/ instead of dist-info/licenses/.
assert any(n.endswith("dist-info/license_files/LICENSE") or n.endswith("dist-info/licenses/LICENSE") for n in names), names
print(whl, "ok")
EOF
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pyheck-${{ env.PYHECK_VERSION }}-cp37-abi3-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish pyheck ${{ inputs.version || '0.1.5' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: pyheck-${{ inputs.version || '0.1.5' }}-*-manylinux_riscv64