docs: Update projects (#2221) #21
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 upstream's documented wheel build: | |
| # https://github.com/couchbase/couchbase-python-client/blob/4.6.3/BUILDING.md | |
| name: Build couchbase wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/couchbase.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-couchbase.yml' | |
| - 'docs/packages/couchbase.yaml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-couchbase.yml' | |
| - 'docs/packages/couchbase.yaml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: couchbase | |
| version: ${{ inputs.version }} | |
| build_sdist: | |
| needs: [setup] | |
| if: needs.setup.outputs.versions != '[]' | |
| name: Build couchbase ${{ matrix.version }} sdist | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| env: | |
| COUCHBASE_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout couchbase ${{ env.COUCHBASE_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: couchbase/couchbase-python-client | |
| ref: ${{ env.COUCHBASE_VERSION }} | |
| submodules: recursive | |
| persist-credentials: false | |
| - name: Install Python | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| python-version: '3.12' | |
| activate-environment: true | |
| enable-cache: false | |
| # configure_ext populates deps/couchbase-cxx-cache, which MANIFEST.in bundles | |
| # into the sdist; without it the riscv job would have to fetch the C++ core's | |
| # dependencies from inside the build container. | |
| - name: Build sdist | |
| run: | | |
| uv pip install build setuptools twine wheel | |
| PYCBC_SET_CPM_CACHE=ON PYCBC_USE_OPENSSL=OFF python setup.py configure_ext | |
| python setup.py sdist | |
| twine check dist/* | |
| env: | |
| CMAKE_POLICY_VERSION_MINIMUM: '3.5' | |
| - name: Upload sdist artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: couchbase-${{ env.COUCHBASE_VERSION }}-sdist | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| build_wheels: | |
| needs: [setup, build_sdist] | |
| if: needs.setup.outputs.versions != '[]' | |
| name: Build couchbase ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| timeout-minutes: 1440 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| python: ["cp312", "cp313", "cp314", "cp314t"] | |
| env: | |
| COUCHBASE_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| - name: Download sdist | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: couchbase-${{ env.COUCHBASE_VERSION }}-sdist | |
| path: dist/ | |
| # The patches reach files the git checkout does not have in a patchable | |
| # shape: one lives in the CPM cache only the sdist carries, the other | |
| # inside the couchbase-cxx-client submodule. | |
| - name: Extract and patch couchbase source | |
| run: | | |
| mkdir couchbase-src | |
| tar zxf dist/couchbase-*.tar.gz -C couchbase-src --strip-components=1 | |
| git apply --directory=couchbase-src python-wheels/patches/couchbase/"${COUCHBASE_VERSION}"/00*.patch | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| package-dir: couchbase-src | |
| output-dir: wheelhouse/ | |
| only: ${{ matrix.python }}-manylinux_riscv64 | |
| env: | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # PYCBC_USE_OPENSSL=OFF is how upstream builds its own wheels: the C++ core | |
| # statically links the vendored BoringSSL instead of the image's OpenSSL. | |
| # CMAKE_POLICY_VERSION_MINIMUM covers the vendored GSL's cmake_minimum_required. | |
| CIBW_ENVIRONMENT: >- | |
| PYCBC_USE_OPENSSL=OFF | |
| PYCBC_CMAKE_PARALLEL_THREADS=$(nproc) | |
| CMAKE_POLICY_VERSION_MINIMUM=3.5 | |
| PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| CIBW_TEST_REQUIRES: pytest | |
| # Upstream's own suite needs a live Couchbase Server, which has no riscv64 | |
| # build, so this drives the C++ core directly instead: a bootstrap against an | |
| # unroutable address has to surface as a Couchbase error, not a crash. | |
| CIBW_TEST_COMMAND: >- | |
| python -c "import importlib.metadata as m; f=[str(p) for p in m.files('couchbase')]; assert any(s.endswith('licenses/LICENSE') for s in f), f; import couchbase; from couchbase.logic.pycbc_core import _core; assert _core.__file__.endswith('.so'), _core.__file__; md = couchbase.get_metadata(); assert md['version'], md; assert 'BoringSSL' in md['openssl_runtime'], md; print(md['version'], md['openssl_runtime'])" && | |
| python -c "import pytest; from datetime import timedelta; from couchbase.auth import PasswordAuthenticator; from couchbase.cluster import Cluster; from couchbase.exceptions import CouchbaseException; from couchbase.options import ClusterOptions, ClusterTimeoutOptions; opts = ClusterOptions(PasswordAuthenticator('u', 'p'), timeout_options=ClusterTimeoutOptions(bootstrap_timeout=timedelta(seconds=15), resolve_timeout=timedelta(seconds=5))); pytest.raises(CouchbaseException, lambda: Cluster.connect('couchbase://192.0.2.1', opts).ping()); print('bootstrap failure surfaced as CouchbaseException')" | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: couchbase-${{ env.COUCHBASE_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish couchbase ${{ matrix.version }} | |
| needs: [setup, build_wheels] | |
| if: needs.setup.outputs.versions != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish-wheel.yml | |
| secrets: | |
| app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} | |
| with: | |
| artifact-pattern: couchbase-${{ matrix.version }}-*-manylinux_riscv64 |