diff --git a/.github/workflows/build-jellyfish.yml b/.github/workflows/build-jellyfish.yml new file mode 100644 index 000000000..f887802e0 --- /dev/null +++ b/.github/workflows/build-jellyfish.yml @@ -0,0 +1,108 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `linux` job of +# https://github.com/jamesturk/jellyfish/blob/v1.2.1/.github/workflows/CI.yml +name: Build jellyfish wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'jellyfish version to build (git tag without leading v, e.g. 1.2.1)' + required: true + default: '1.2.1' + pull_request: + paths: + - '.github/workflows/build-jellyfish.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '1.2.1' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + JELLYFISH_VERSION: ${{ inputs.version || '1.2.1' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + build_wheels: + name: Build jellyfish ${{ inputs.version || '1.2.1' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + # PyO3 extension built per interpreter (upstream ships cp3x-cp3x wheels, + # no abi3). cp314t is excluded: upstream publishes no free-threaded wheel + # and the module does not declare `gil_used(false)`, so it would re-enable + # the GIL on import. + python: ["cp312", "cp313", "cp314"] + + steps: + # PyPI records the Codeberg repository, but upstream's releases and CI live + # on this GitHub mirror; the v1.2.1 tree matches the released sdist. + - name: Checkout jellyfish ${{ env.JELLYFISH_VERSION }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + repository: jamesturk/jellyfish + ref: v${{ env.JELLYFISH_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + # musllinux is out of reach: rustup publishes rust-std but no rustc/cargo + # host toolchain for riscv64gc-unknown-linux-musl. + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # jellyfish 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 --profile minimal + CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' + CIBW_TEST_REQUIRES: pytest + # The suite opens testdata/*.csv relative to the working directory, so + # stage it beside tests/ at its original path. + CIBW_TEST_SOURCES: tests testdata + CIBW_TEST_COMMAND: python -m pytest tests + + - name: Check the extension module made it into the wheel + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + assert any(n.startswith("jellyfish/_rustyfish.") and n.endswith(".so") + for n in names), names + print(whl, "ok") + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: jellyfish-${{ env.JELLYFISH_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish jellyfish ${{ inputs.version || '1.2.1' }} to GitLab + needs: [build_wheels] + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Publish wheels and open docs PR + uses: riseproject-dev/python-wheels/actions/publish-wheels@main + with: + artifact-pattern: jellyfish-${{ env.JELLYFISH_VERSION }}-*-manylinux_riscv64 + gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} + gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} + gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} + gh-token: ${{ secrets.GITHUB_TOKEN }}