|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on: https://github.com/scikit-hep/fastjet/blob/v3.5.1.4/.github/workflows/wheels.yml |
| 5 | +name: Build fastjet wheels (riscv64) |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + version: |
| 11 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/fastjet.yaml not released yet' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + pull_request: |
| 15 | + branches: [main] |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-fastjet.yml' |
| 18 | + - 'docs/packages/fastjet.yaml' |
| 19 | + - 'patches/fastjet/**' |
| 20 | + push: |
| 21 | + branches: [main] |
| 22 | + paths: |
| 23 | + - '.github/workflows/build-fastjet.yml' |
| 24 | + - 'docs/packages/fastjet.yaml' |
| 25 | + - 'patches/fastjet/**' |
| 26 | + |
| 27 | +concurrency: |
| 28 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 29 | + cancel-in-progress: true |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: read # to fetch code (actions/checkout) |
| 33 | + |
| 34 | +env: |
| 35 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 36 | + |
| 37 | +jobs: |
| 38 | + setup: |
| 39 | + uses: $/.github/workflows/_setup.yml |
| 40 | + with: |
| 41 | + package: fastjet |
| 42 | + version: ${{ inputs.version }} |
| 43 | + |
| 44 | + build_wheels: |
| 45 | + needs: [setup] |
| 46 | + if: needs.setup.outputs.versions != '[]' |
| 47 | + name: Build fastjet ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 48 | + runs-on: ubuntu-24.04-riscv |
| 49 | + timeout-minutes: 360 |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 54 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 55 | + env: |
| 56 | + FASTJET_VERSION: ${{ matrix.version }} |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout fastjet ${{ env.FASTJET_VERSION }} |
| 60 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 61 | + with: |
| 62 | + repository: scikit-hep/fastjet |
| 63 | + ref: v${{ env.FASTJET_VERSION }} |
| 64 | + submodules: recursive |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Checkout python-wheels |
| 68 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 69 | + with: |
| 70 | + path: python-wheels |
| 71 | + persist-credentials: false |
| 72 | + |
| 73 | + - name: Patch fastjet source |
| 74 | + run: git apply python-wheels/patches/fastjet/${{ env.FASTJET_VERSION }}/*.patch |
| 75 | + |
| 76 | + - name: Build wheels |
| 77 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 78 | + with: |
| 79 | + output-dir: wheelhouse/ |
| 80 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 81 | + env: |
| 82 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 83 | + CIBW_CONFIG_SETTINGS: > |
| 84 | + "cmake.define.FASTJET_ENABLE_CGAL"="ON" |
| 85 | + # Licence notices of the CGAL and Boost headers compiled in by upstream's before-all. |
| 86 | + CIBW_BEFORE_BUILD: >- |
| 87 | + cp {project}/boost_1_88_0/LICENSE_1_0.txt {project}/LICENSE.boost && |
| 88 | + cp /usr/local/share/doc/CGAL/LICENSE {project}/LICENSE.CGAL && |
| 89 | + cp /usr/local/share/doc/CGAL/LICENSE.GPL {project}/LICENSE.CGAL.GPL && |
| 90 | + cp /usr/local/share/doc/CGAL/LICENSE.LGPL {project}/LICENSE.CGAL.LGPL |
| 91 | + # Our registry carries awkward-cpp 56, not PyPI's newest 57: stay on awkward 2.13.0. |
| 92 | + CIBW_ENVIRONMENT: >- |
| 93 | + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_FASTJET=${{ env.FASTJET_VERSION }} |
| 94 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 95 | + PIP_ONLY_BINARY=numpy,awkward-cpp,pyarrow,pandas,boost-histogram |
| 96 | + # pandas (via dask-awkward[test]) has no free-threaded riscv64 wheel, so cp314t gets |
| 97 | + # upstream's `test` extra minus dask-awkward's own [test] extra. Keep dask, dask-awkward |
| 98 | + # and distributed in the same pip call: cibuildwheel installs the wheel's extras and |
| 99 | + # test-requires in two separate pip runs, and splitting them let the second run pull |
| 100 | + # distributed 2026.8.0, which upgraded dask past dask-awkward 2026.2.1's dask<2025.4.0 |
| 101 | + # pin and broke test_008-dask.py ("Cannot fuse tasks with multiple outputs"). |
| 102 | + CIBW_TEST_EXTRAS: ${{ matrix.python == 'cp314t' && 'dev' || 'test' }} |
| 103 | + CIBW_TEST_REQUIRES: ${{ matrix.python == 'cp314t' && 'uproot>=5 dask>=2023.4.0 dask-awkward>=2023.4.2 distributed>=2023.4.0' || '' }} |
| 104 | + |
| 105 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 106 | + with: |
| 107 | + name: fastjet-${{ env.FASTJET_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 108 | + path: wheelhouse/*.whl |
| 109 | + if-no-files-found: error |
| 110 | + |
| 111 | + - name: Check the wheel ships the extensions and the bundled licences |
| 112 | + run: | |
| 113 | + python3 - wheelhouse/*.whl <<'EOF' |
| 114 | + import sys, zipfile |
| 115 | +
|
| 116 | + names = zipfile.ZipFile(sys.argv[1]).namelist() |
| 117 | + for mod in ("fastjet/_ext.", "fastjet/_swig/_fastjet_swig."): |
| 118 | + assert any(n.startswith(mod) and n.endswith(".so") for n in names), mod |
| 119 | + for lib in ("fastjet", "fastjettools", "fastjetplugins", "siscone", "fastjetcontribfragile"): |
| 120 | + assert f"fastjet/lib64/lib{lib}.so" in names, lib |
| 121 | + assert not any(n.startswith("fastjet.libs/") for n in names), names |
| 122 | + licences = {n.split(".dist-info/licenses/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""} |
| 123 | + for want in ("LICENSE", "LICENSE.boost", "LICENSE.CGAL", "LICENSE.CGAL.GPL", "LICENSE.CGAL.LGPL", |
| 124 | + "extern/fastjet-core/COPYING", "extern/fastjet-core/plugins/SISCone/siscone/COPYING", |
| 125 | + "extern/fastjet-contrib/COPYING", "extern/fastjet-contrib/Nsubjettiness/COPYING"): |
| 126 | + assert want in licences, (want, sorted(licences)) |
| 127 | + print(sys.argv[1], len(licences), "licence files ok") |
| 128 | + EOF |
| 129 | +
|
| 130 | + publish: |
| 131 | + name: Publish fastjet ${{ matrix.version }} |
| 132 | + needs: [setup, build_wheels] |
| 133 | + if: needs.setup.outputs.versions != '[]' |
| 134 | + strategy: |
| 135 | + fail-fast: false |
| 136 | + matrix: |
| 137 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 138 | + permissions: |
| 139 | + contents: write |
| 140 | + pull-requests: write |
| 141 | + uses: $/.github/workflows/_publish-wheel.yml |
| 142 | + secrets: |
| 143 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 144 | + with: |
| 145 | + artifact-pattern: fastjet-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments