|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on: https://github.com/fplll/fpylll/blob/0.6.4/.github/workflows/tests.yml |
| 5 | +# fpylll's own release.yml builds wheels via passagemath's Sage-distribution |
| 6 | +# tooling (not reusable here); tests.yml's from-source fplll build is what we |
| 7 | +# mirror, narrowed to riscv64. |
| 8 | +name: Build fpylll wheels (riscv64) |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + version: |
| 14 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/fpylll.yaml not released yet' |
| 15 | + required: false |
| 16 | + default: '' |
| 17 | + pull_request: |
| 18 | + branches: [main] |
| 19 | + paths: |
| 20 | + - '.github/workflows/build-fpylll.yml' |
| 21 | + - 'docs/packages/fpylll.yaml' |
| 22 | + push: |
| 23 | + branches: [main] |
| 24 | + paths: |
| 25 | + - '.github/workflows/build-fpylll.yml' |
| 26 | + - 'docs/packages/fpylll.yaml' |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +permissions: |
| 33 | + contents: read # to fetch code (actions/checkout) |
| 34 | + |
| 35 | +env: |
| 36 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 37 | + # The C++ fplll release fpylll 0.6.4 is tested against (tests.yml clones |
| 38 | + # fplll's default branch, which was 5.5.0 at the time of this release). |
| 39 | + FPLLL_CXX_VERSION: '5.5.0' |
| 40 | + FPLLL_CXX_SHA256: 'f0af6bdd0ebd5871e87ff3ef7737cb5360b1e38181a4e5a8c1236f3476fec3b2' |
| 41 | + |
| 42 | +jobs: |
| 43 | + setup: |
| 44 | + uses: $/.github/workflows/_setup.yml |
| 45 | + with: |
| 46 | + package: fpylll |
| 47 | + version: ${{ inputs.version }} |
| 48 | + |
| 49 | + build_wheels: |
| 50 | + needs: [setup] |
| 51 | + if: needs.setup.outputs.versions != '[]' |
| 52 | + name: Build fpylll ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 53 | + runs-on: ubuntu-24.04-riscv |
| 54 | + timeout-minutes: 120 |
| 55 | + strategy: |
| 56 | + fail-fast: false |
| 57 | + matrix: |
| 58 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 59 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 60 | + # musllinux dropped: same shape of C++-from-source build as |
| 61 | + # symengine/gmpy2/chiavdf, none of which target musllinux either. |
| 62 | + |
| 63 | + env: |
| 64 | + FPYLLL_VERSION: ${{ matrix.version }} |
| 65 | + |
| 66 | + steps: |
| 67 | + - name: Checkout fpylll ${{ env.FPYLLL_VERSION }} |
| 68 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 69 | + with: |
| 70 | + repository: fplll/fpylll |
| 71 | + ref: ${{ env.FPYLLL_VERSION }} |
| 72 | + persist-credentials: false |
| 73 | + |
| 74 | + - name: Build wheels |
| 75 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 76 | + with: |
| 77 | + output-dir: wheelhouse/ |
| 78 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 79 | + env: |
| 80 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 81 | + # gmp/mpfr come from Rocky 10's own repos (gmp-devel, mpfr-devel); |
| 82 | + # fplll itself has no Rocky package and is built once per container |
| 83 | + # from its own release tarball, with the same configure flags |
| 84 | + # tests.yml uses. --libdir=/usr/lib64 matches where gmp-devel/ |
| 85 | + # mpfr-devel already put their libraries, so no extra -L/-I or |
| 86 | + # LD_LIBRARY_PATH plumbing is needed for setup.py's hardcoded |
| 87 | + # sys.prefix-relative include/library dirs. libqd is skipped: |
| 88 | + # Rocky 10 ships no qd package on any arch, and HAVE_QD=no is one |
| 89 | + # of the two configurations tests.yml itself exercises. |
| 90 | + CIBW_BEFORE_ALL_LINUX: >- |
| 91 | + dnf -y install gmp-devel mpfr-devel && |
| 92 | + cd /tmp && |
| 93 | + curl -fsSLO https://github.com/fplll/fplll/releases/download/${{ env.FPLLL_CXX_VERSION }}/fplll-${{ env.FPLLL_CXX_VERSION }}.tar.gz && |
| 94 | + echo "${{ env.FPLLL_CXX_SHA256 }} fplll-${{ env.FPLLL_CXX_VERSION }}.tar.gz" | sha256sum -c - && |
| 95 | + tar xzf fplll-${{ env.FPLLL_CXX_VERSION }}.tar.gz && |
| 96 | + cd fplll-${{ env.FPLLL_CXX_VERSION }} && |
| 97 | + ./configure --disable-static --prefix=/usr --libdir=/usr/lib64 --with-max-enum-dim=64 --with-max-parallel-enum-dim=20 && |
| 98 | + make -j"$(nproc)" && make install && ldconfig && |
| 99 | + cp COPYING /project/LICENSE.fplll && |
| 100 | + cp /usr/share/licenses/gmp/COPYINGv3 /project/LICENSE.gmp && |
| 101 | + cp /usr/share/licenses/mpfr/COPYING.LESSER /project/LICENSE.mpfr |
| 102 | + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 103 | + CIBW_TEST_REQUIRES: pytest numpy |
| 104 | + CIBW_TEST_SOURCES: tests |
| 105 | + CIBW_TEST_COMMAND: PY_IGNORE_IMPORTMISMATCH=1 python -m pytest tests -v |
| 106 | + |
| 107 | + - name: Check the extensions and vendored libraries made it into the wheel |
| 108 | + run: | |
| 109 | + python3 - wheelhouse/*.whl <<'EOF' |
| 110 | + import sys, zipfile |
| 111 | + for whl in sys.argv[1:]: |
| 112 | + names = zipfile.ZipFile(whl).namelist() |
| 113 | + so = {n for n in names if n.endswith(".so")} |
| 114 | + assert any(n.startswith("fpylll/fplll/lll") for n in so), so |
| 115 | + assert any(n.startswith("fpylll/util") for n in so), so |
| 116 | + libs = {n.split("/")[-1].split("-")[0] for n in names if ".libs/" in n and not n.endswith("/")} |
| 117 | + assert "libfplll" in libs, libs |
| 118 | + print(whl, "ok") |
| 119 | + EOF |
| 120 | +
|
| 121 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 122 | + with: |
| 123 | + name: fpylll-${{ env.FPYLLL_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 124 | + path: wheelhouse/*.whl |
| 125 | + if-no-files-found: error |
| 126 | + |
| 127 | + gpl_sources: |
| 128 | + needs: [setup] |
| 129 | + if: needs.setup.outputs.versions != '[]' |
| 130 | + strategy: |
| 131 | + fail-fast: false |
| 132 | + matrix: |
| 133 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 134 | + name: Collect GPL sources |
| 135 | + runs-on: ubuntu-24.04-riscv |
| 136 | + |
| 137 | + env: |
| 138 | + FPYLLL_VERSION: ${{ matrix.version }} |
| 139 | + |
| 140 | + steps: |
| 141 | + - name: Checkout python-wheels |
| 142 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 143 | + with: |
| 144 | + persist-credentials: false |
| 145 | + |
| 146 | + - uses: ./actions/collect-gpl-sources |
| 147 | + with: |
| 148 | + image: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 149 | + packages: gcc gmp mpfr |
| 150 | + output: gpl-sources.tar |
| 151 | + |
| 152 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 153 | + with: |
| 154 | + name: fpylll-${{ env.FPYLLL_VERSION }}-gpl-sources |
| 155 | + path: gpl-sources.tar |
| 156 | + if-no-files-found: error |
| 157 | + |
| 158 | + publish: |
| 159 | + name: Publish fpylll ${{ matrix.version }} |
| 160 | + needs: [setup, build_wheels, gpl_sources] |
| 161 | + if: needs.setup.outputs.versions != '[]' |
| 162 | + strategy: |
| 163 | + fail-fast: false |
| 164 | + matrix: |
| 165 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 166 | + permissions: |
| 167 | + contents: write |
| 168 | + pull-requests: write |
| 169 | + uses: $/.github/workflows/_publish-wheel.yml |
| 170 | + secrets: |
| 171 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 172 | + with: |
| 173 | + artifact-pattern: fpylll-${{ matrix.version }}-*-manylinux_riscv64 |
| 174 | + gpl-sources-artifact: fpylll-${{ matrix.version }}-gpl-sources |
| 175 | + gpl-sources-description: gcc, gmp, mpfr |
0 commit comments