|
| 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