|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on: https://github.com/acsylla/acsylla/blob/master/.github/workflows/release-linux-aarch64.yml |
| 5 | +name: Build acsylla 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/acsylla.yaml not released yet' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + pull_request: |
| 15 | + branches: [main] |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-acsylla.yml' |
| 18 | + - 'docs/packages/acsylla.yaml' |
| 19 | + push: |
| 20 | + branches: [main] |
| 21 | + paths: |
| 22 | + - '.github/workflows/build-acsylla.yml' |
| 23 | + - 'docs/packages/acsylla.yaml' |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read # to fetch code (actions/checkout) |
| 31 | + |
| 32 | +env: |
| 33 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 34 | + |
| 35 | +jobs: |
| 36 | + setup: |
| 37 | + uses: $/.github/workflows/_setup.yml |
| 38 | + with: |
| 39 | + package: acsylla |
| 40 | + version: ${{ inputs.version }} |
| 41 | + |
| 42 | + build_wheels: |
| 43 | + needs: [setup] |
| 44 | + if: needs.setup.outputs.versions != '[]' |
| 45 | + name: Build acsylla ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 46 | + runs-on: ubuntu-24.04-riscv |
| 47 | + timeout-minutes: 240 |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 52 | + python: |
| 53 | + - "cp312" |
| 54 | + - "cp313" |
| 55 | + - "cp314" |
| 56 | + - "cp314t" |
| 57 | + |
| 58 | + env: |
| 59 | + ACSYLLA_VERSION: ${{ matrix.version }} |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Checkout acsylla ${{ env.ACSYLLA_VERSION }} |
| 63 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 64 | + with: |
| 65 | + repository: acsylla/acsylla |
| 66 | + ref: v${{ env.ACSYLLA_VERSION }} |
| 67 | + submodules: true |
| 68 | + persist-credentials: false |
| 69 | + |
| 70 | + - name: Build wheels |
| 71 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 72 | + with: |
| 73 | + output-dir: wheelhouse/ |
| 74 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 75 | + env: |
| 76 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 77 | + # bin/build_manylinux_2_28_wheel.sh, plus the notices of the statically linked |
| 78 | + # cpp-driver (and its third_party code), libuv and the bundled OpenSSL, which |
| 79 | + # upstream's wheels do not ship. |
| 80 | + CIBW_BEFORE_ALL_LINUX: | |
| 81 | + set -ex |
| 82 | + dnf install -y openssl-devel |
| 83 | + LIBUV_VERSION=1.52.1 |
| 84 | + curl -fsSLO https://dist.libuv.org/dist/v$LIBUV_VERSION/libuv-v$LIBUV_VERSION.tar.gz |
| 85 | + tar -xzf libuv-v$LIBUV_VERSION.tar.gz |
| 86 | + (cd libuv-v$LIBUV_VERSION && sh autogen.sh && CFLAGS="-O3 -flto -fPIC" LDFLAGS="-flto" ./configure --with-pic && make && make install) |
| 87 | + git config --global --add safe.directory '*' |
| 88 | + make install-driver |
| 89 | + cp libuv-v$LIBUV_VERSION/LICENSE LICENSE.libuv |
| 90 | + cp libuv-v$LIBUV_VERSION/LICENSE-extra LICENSE.libuv-extra |
| 91 | + cp vendor/cpp-driver/licenses/apache-2.0.txt LICENSE.cpp-driver |
| 92 | + cp vendor/cpp-driver/src/third_party/curl/COPYING LICENSE.cpp-driver-curl |
| 93 | + cp vendor/cpp-driver/src/third_party/hdr_histogram/LICENSE.txt LICENSE.cpp-driver-hdr_histogram |
| 94 | + cp vendor/cpp-driver/src/third_party/http-parser/LICENSE-MIT LICENSE.cpp-driver-http-parser |
| 95 | + cp vendor/cpp-driver/src/third_party/rapidjson/license.txt LICENSE.cpp-driver-rapidjson |
| 96 | + cp vendor/cpp-driver/src/third_party/sparsehash/COPYING LICENSE.cpp-driver-sparsehash |
| 97 | + cp /usr/share/licenses/openssl-libs/LICENSE.txt LICENSE.openssl |
| 98 | + CIBW_ENVIRONMENT: >- |
| 99 | + LIBUV_ROOT_DIR=/usr/local |
| 100 | + UV_LIBRARY_PATH=/usr/local/lib |
| 101 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 102 | + CIBW_BEFORE_BUILD: make cythonize |
| 103 | + # Upstream tests against the cassandra:latest image, which has no riscv64 build; |
| 104 | + # run the same Cassandra release on Temurin 17 (the image's JRE) in the container. |
| 105 | + CIBW_BEFORE_TEST_LINUX: | |
| 106 | + set -ex |
| 107 | + dnf install -y procps-ng |
| 108 | + curl -fsSL -o /tmp/jre.tar.gz https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.20.1%2B1/OpenJDK17U-jre_riscv64_linux_hotspot_17.0.20.1_1.tar.gz |
| 109 | + echo "79c40c11fbad2b6771d08b9d4a7328bedfe49660b711930d3fe6529e5f28f99f /tmp/jre.tar.gz" | sha256sum -c - |
| 110 | + curl -fsSL -o /tmp/cassandra.tar.gz https://archive.apache.org/dist/cassandra/5.0.9/apache-cassandra-5.0.9-bin.tar.gz |
| 111 | + echo "beaf3df6342ef1a0ccc83fa80214f250b32c35cfbb1af591b00e3fd539eef0915bc3b89f0e7ae73f6d50cbb03f6075c4e4cf32d3c46ff9c33f745542fcc925df /tmp/cassandra.tar.gz" | sha512sum -c - |
| 112 | + mkdir -p /opt/jre /opt/cassandra |
| 113 | + tar -xzf /tmp/jre.tar.gz -C /opt/jre --strip-components=1 |
| 114 | + tar -xzf /tmp/cassandra.tar.gz -C /opt/cassandra --strip-components=1 |
| 115 | + export JAVA_HOME=/opt/jre PATH=/opt/jre/bin:$PATH |
| 116 | + cd / && bash /project/bin/make_test_certs.sh |
| 117 | + cp /project/conf/cassandra/cassandra.yaml /opt/cassandra/conf/cassandra.yaml |
| 118 | + /opt/cassandra/bin/cassandra -R > /tmp/cassandra.out 2>&1 |
| 119 | + for i in $(seq 900); do (echo > /dev/tcp/127.0.0.1/9042) 2>/dev/null && exit 0; sleep 1; done |
| 120 | + cat /tmp/cassandra.out /opt/cassandra/logs/system.log; exit 1 |
| 121 | + CIBW_TEST_REQUIRES: pytest pytest-asyncio pytest-cov |
| 122 | + CIBW_TEST_SOURCES: tests pyproject.toml |
| 123 | + CIBW_TEST_COMMAND: >- |
| 124 | + python -c "import importlib.metadata as m; f={p.name for p in m.files('acsylla') if '.dist-info/licenses/' in str(p)}; assert {'LICENSE.cpp-driver', 'LICENSE.libuv', 'LICENSE.openssl'} <= f, f" && |
| 125 | + ln -s /certs certs && python -m pytest -v tests |
| 126 | +
|
| 127 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 128 | + with: |
| 129 | + name: acsylla-${{ env.ACSYLLA_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 130 | + path: wheelhouse/*.whl |
| 131 | + if-no-files-found: error |
| 132 | + |
| 133 | + publish: |
| 134 | + name: Publish acsylla ${{ matrix.version }} |
| 135 | + needs: [setup, build_wheels] |
| 136 | + if: needs.setup.outputs.versions != '[]' |
| 137 | + strategy: |
| 138 | + fail-fast: false |
| 139 | + matrix: |
| 140 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 141 | + permissions: |
| 142 | + contents: write |
| 143 | + pull-requests: write |
| 144 | + uses: $/.github/workflows/_publish-wheel.yml |
| 145 | + secrets: |
| 146 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 147 | + with: |
| 148 | + artifact-pattern: acsylla-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments