ci: publish wheels as immutable GitHub releases #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 The RISE Project | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| # This workflow is based on the ManyLinux jobs of | |
| # https://github.com/jpype-project/jpype/blob/v1.7.1/.azure/release.yml | |
| # (.azure/scripts/{ivy,wheels-linux,build-wheels,test}.yml). | |
| name: Build JPype1 wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'JPype1 version to build (git tag without leading v, e.g. 1.7.1)' | |
| required: true | |
| default: '1.7.1' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/build-jpype1.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.version || '1.7.1' }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| JPYPE1_VERSION: ${{ inputs.version || '1.7.1' }} | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| build_wheels: | |
| needs: [setup] | |
| name: Build JPype1 ${{ inputs.version || '1.7.1' }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["cp312", "cp313", "cp314", "cp314t"] | |
| steps: | |
| - name: Checkout JPype1 v${{ env.JPYPE1_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: jpype-project/jpype | |
| ref: v${{ env.JPYPE1_VERSION }} | |
| persist-credentials: false | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| output-dir: wheelhouse/ | |
| only: ${{ matrix.python }}-manylinux_riscv64 | |
| env: | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # Upstream builds against JDK 11; Rocky 10 only packages JDK 21. | |
| CIBW_ENVIRONMENT: >- | |
| JAVA_HOME=/usr/lib/jvm/java-21-openjdk | |
| PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| # The ivy resolve is upstream's own `.azure/scripts/ivy.yml` stage; it stages the | |
| # JDBC drivers the DBAPI tests load from `lib/`. sqlite-jdbc is bumped off | |
| # upstream's 3.27.2.1 pin because that release bundles no riscv64 native library. | |
| CIBW_BEFORE_ALL_LINUX: >- | |
| dnf -y install java-21-openjdk-devel ant && | |
| cd {project} && | |
| sed -i 's/"sqlite-jdbc" rev="[^"]*"/"sqlite-jdbc" rev="3.46.1.3"/' ivy.xml && | |
| curl -sSL --create-dirs -o lib/ivy-2.5.3.jar | |
| https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.5.3/ivy-2.5.3.jar && | |
| java -jar lib/ivy-2.5.3.jar -ivy ivy.xml | |
| -retrieve 'lib/[artifact]-[revision](-[classifier]).[ext]' | |
| # test-requirements.txt minus pyinstaller: it publishes no riscv64 wheel and | |
| # nothing under test/ imports it (upstream exercises it in a separate step). | |
| CIBW_TEST_REQUIRES: pytest numpy typing_extensions jedi==0.18.0 | |
| # Upstream's own invocation; `cd` first so jpype resolves to the installed wheel | |
| # rather than the checkout. The deselected four assert `lastrowid`, which the | |
| # newer sqlite-jdbc no longer reports through `getGeneratedKeys`; paths are | |
| # relative to the pytest rootdir (the checkout), not to the cwd. | |
| CIBW_TEST_COMMAND: >- | |
| cd {project}/test && | |
| python -m pytest -v jpypetest --checkjni | |
| --deselect test/jpypetest/test_sql_sqlite.py::CursorTestCase::test_fetchall | |
| --deselect test/jpypetest/test_sql_sqlite.py::CursorTestCase::test_fetchone | |
| --deselect test/jpypetest/test_sql_sqlite.py::CursorTestCase::test_lastrowid | |
| --deselect test/jpypetest/test_sql_sqlite.py::CursorTestCase::test_lastrowidMany | |
| - name: Check the extension and the JAR 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("_jpype.") and n.endswith(".so") for n in names), whl | |
| assert "org.jpype.jar" in names, whl | |
| print(whl, "ok") | |
| EOF | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: jpype1-${{ env.JPYPE1_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish JPype1 ${{ inputs.version || '1.7.1' }} | |
| needs: [setup, build_wheels] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish_wheel.yml | |
| with: | |
| artifact-pattern: jpype1-${{ inputs.version || '1.7.1' }}-*-manylinux_riscv64 |