Skip to content

ci: publish wheels as immutable GitHub releases #13

ci: publish wheels as immutable GitHub releases

ci: publish wheels as immutable GitHub releases #13

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on: https://github.com/mongodb/mongo-python-driver/blob/4.17.0/.github/workflows/dist.yml
# Build-from-checkout, inheriting upstream's [tool.cibuildwheel] (build-frontend, skip).
name: Build pymongo wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'pymongo version to build (git tag, e.g. 4.17.0)'
required: true
default: '4.17.0'
pull_request:
paths:
- '.github/workflows/build-pymongo.yml'
concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '4.17.0' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
PYMONGO_VERSION: ${{ inputs.version || '4.17.0' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
build_wheels:
needs: [setup]
name: Build pymongo ${{ inputs.version || '4.17.0' }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
# bson._cbson / pymongo._cmessage are plain per-interpreter C extensions.
python: [cp312, cp313, cp314, cp314t]
steps:
- name: Checkout pymongo ${{ env.PYMONGO_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: mongodb/mongo-python-driver
ref: ${{ env.PYMONGO_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 }}
# _setup.py swallows build_ext failures and ships a pure-Python wheel
# unless this is set (CLAUDE.md gotcha 20).
CIBW_ENVIRONMENT: PYMONGO_C_EXT_MUST_BUILD=1
# Staged into the (empty) test cwd so pytest imports the installed wheel
# rather than the checkout's pure-Python bson/ and pymongo/ packages.
CIBW_TEST_SOURCES: test tools pyproject.toml
# pytest-asyncio is pinned to upstream's uv.lock version; 1.4 turns
# conftest's event_loop_policy override into an error under
# pyproject's filterwarnings = error.
CIBW_TEST_REQUIRES: pytest>=8.2 pytest-asyncio==1.3.0
# Upstream's own wheel test is fail_if_no_c.py; the pytest modules are the
# subset of the suite that exercises the C extension without a mongod.
CIBW_TEST_COMMAND: >-
python tools/fail_if_no_c.py &&
python -m pytest
test/test_bson.py test/test_bson_corpus.py test/test_bson_binary_vector.py
test/test_raw_bson.py test/test_custom_types.py test/test_json_util.py
test/test_objectid.py test/test_decimal128.py test/test_timestamp.py
test/test_code.py test/test_binary.py test/test_son.py test/test_dbref.py
test/test_uri_parser.py
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pymongo-${{ env.PYMONGO_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish pymongo ${{ inputs.version || '4.17.0' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish_wheel.yml
with:
artifact-pattern: pymongo-${{ inputs.version || '4.17.0' }}-*-manylinux_riscv64