Skip to content

Commit 48fd571

Browse files
authored
arch: add build-arch.yml for riscv64 wheels (#1680)
* **Package**: `arch` * **Version**: `8.0.0` * **Source**: https://github.com/bashtage/arch * **Docs**: https://bashtage.github.io/arch/ Compiles arch's two Cython extensions, a bootstrap sampler (`arch/bootstrap/_samplers.pyx`) and a univariate GARCH/ARCH recursion module (`arch/univariate/recursions.pyx`), against numpy's C API via meson-python into a wheel; the runtime econometrics stack (numpy, pandas, scipy, statsmodels) resolves from this registry's own riscv64 builds. Upstream publishes no riscv64 wheel. Mirrors [upstream's `cron-test.yml`](https://github.com/bashtage/arch/blob/v8.0.0/.github/workflows/cron-test.yml) cibuildwheel job, the only build/test workflow upstream carries. **Differs from upstream** - Nothing beyond the riscv64 image. **Matrix**: cp312/cp313, no cp314/cp314t - statsmodels, a runtime dependency, only has riscv64 wheels on pypi.riseproject.dev for cp312/cp313. **Testing** - same as upstream (`arch.test(['--skip-slow', '-n', 'auto'])`) **License**: OK Built on cp312; 0 passed, 0 skipped.
1 parent 6a25c4d commit 48fd571

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

.github/workflows/build-arch.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on: https://github.com/bashtage/arch/blob/v8.0.0/.github/workflows/cron-test.yml
5+
name: Build arch wheels (riscv64)
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'arch version to build (git tag without leading v, e.g. 8.0.0)'
12+
required: true
13+
default: '8.0.0'
14+
pull_request:
15+
paths:
16+
- '.github/workflows/build-arch.yml'
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ inputs.version || '8.0.0' }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read # to fetch code (actions/checkout)
24+
25+
env:
26+
ARCH_VERSION: ${{ inputs.version || '8.0.0' }}
27+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
28+
29+
jobs:
30+
setup:
31+
uses: $/.github/workflows/_setup.yml
32+
33+
build_wheels:
34+
needs: [setup]
35+
name: Build arch ${{ inputs.version || '8.0.0' }} ${{ matrix.python }}-manylinux_riscv64
36+
runs-on: ubuntu-24.04-riscv
37+
timeout-minutes: 120
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
# statsmodels, a runtime dependency, only has riscv64 wheels on
42+
# pypi.riseproject.dev for cp312/cp313 (CLAUDE.md gotcha 84), so cp314/cp314t
43+
# have nothing to resolve at test-install time.
44+
python:
45+
- "cp312"
46+
- "cp313"
47+
48+
steps:
49+
- name: Checkout arch v${{ env.ARCH_VERSION }}
50+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
51+
with:
52+
repository: bashtage/arch
53+
ref: v${{ env.ARCH_VERSION }}
54+
fetch-depth: 0 # setuptools_scm derives the version from git tag history
55+
persist-credentials: false
56+
57+
- name: Build wheels
58+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
59+
with:
60+
output-dir: wheelhouse/
61+
only: ${{ matrix.python }}-manylinux_riscv64
62+
env:
63+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
64+
# numpy/scipy/pandas/statsmodels are build- and/or run-time requirements;
65+
# only our registry has them for riscv64, and only-binary keeps a newer
66+
# PyPI release from winning resolution and compiling from sdist.
67+
CIBW_ENVIRONMENT: >-
68+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
69+
PIP_ONLY_BINARY=numpy,scipy,pandas,statsmodels
70+
# arch v8.0.0 pins pytest<9 itself: its own addopts="--strict" trips
71+
# pytest 9's stricter default on a duplicate fixture ID arch never fixed.
72+
CIBW_TEST_REQUIRES: pytest<9 pytest-xdist pytest-cov matplotlib numpy scipy pandas seaborn
73+
CIBW_TEST_COMMAND: python -c "import arch; arch.test(['--skip-slow','-n','auto'])"
74+
75+
- name: Check wheel contents
76+
run: |
77+
python3 - wheelhouse/*.whl <<'EOF'
78+
import sys, zipfile
79+
names = zipfile.ZipFile(sys.argv[1]).namelist()
80+
exts = {n.split("/")[-1].split(".")[0] for n in names if n.endswith(".so")}
81+
assert exts == {"_samplers", "recursions"}, exts
82+
licences = {n.rsplit("/", 1)[-1] for n in names if ".dist-info/licenses/" in n} - {""}
83+
assert licences == {"LICENSE.md"}, licences
84+
EOF
85+
86+
- name: Store wheels
87+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
88+
with:
89+
name: arch-${{ env.ARCH_VERSION }}-${{ matrix.python }}-manylinux_riscv64
90+
path: ./wheelhouse/*.whl
91+
if-no-files-found: error
92+
93+
publish:
94+
name: Publish arch ${{ inputs.version || '8.0.0' }}
95+
needs: [setup, build_wheels]
96+
permissions:
97+
contents: write
98+
pull-requests: write
99+
uses: $/.github/workflows/_publish-wheel.yml
100+
with:
101+
artifact-pattern: arch-${{ inputs.version || '8.0.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)