Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/build-duckdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/duckdb/duckdb-python/blob/v1.5.5/.github/workflows/packaging_wheels.yml
name: Build duckdb wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'duckdb version to build (git tag without the leading v, e.g. 1.5.5)'
required: true
default: '1.5.5'
pull_request:
paths:
- '.github/workflows/build-duckdb.yml'

concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '1.5.5' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
# `inputs.version` is empty on pull_request events; default to 1.5.5 there.
DUCKDB_VERSION: ${{ inputs.version || '1.5.5' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

jobs:
build_wheels:
name: Build duckdb ${{ inputs.version || '1.5.5' }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 1440
strategy:
fail-fast: false
matrix:
# Upstream publishes no free-threaded wheel.
python: ["cp312", "cp313", "cp314"]

steps:
- name: Checkout duckdb-python v${{ env.DUCKDB_VERSION }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: duckdb/duckdb-python
ref: v${{ env.DUCKDB_VERSION }}
submodules: true
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's build[uv] frontend crashes cibuildwheel's audit step here (no host uv).
CIBW_BUILD_FRONTEND: build
# Clears upstream's `yum install -y ccache`: ccache is EPEL-only, and the riscv64 manylinux image has no EPEL.
CIBW_BEFORE_BUILD: ''
# Upstream's release job pins the version the same way (packaging.yml set-version).
CIBW_ENVIRONMENT: >-
OVERRIDE_GIT_DESCRIBE=v${{ env.DUCKDB_VERSION }}
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
# Test phase only, so it can't starve the build backend (gotcha 12).
CIBW_TEST_ENVIRONMENT: 'PIP_ONLY_BINARY=:all:'
CIBW_TEST_SOURCES: tests
# Upstream's test group minus deps with no riscv64 wheel; their tests are importorskip-guarded.
CIBW_TEST_REQUIRES: >-
pytest pytest-reraise pytest-timeout pytest-timestamper packaging psutil
pytz requests typing-extensions urllib3 fsspec numpy pandas==3.0.3
# Upstream's `testsuite: fast` invocation (tests/slow needs network fixtures).
CIBW_TEST_COMMAND: >-
python -c "import _duckdb; assert _duckdb.__file__.endswith('.so'), _duckdb.__file__" &&
python -m pytest --confcutdir=. --rootdir . -c {project}/pyproject.toml ./tests/fast

- 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.endswith(".so") for n in names), f"no compiled extension in {whl}"
print(whl, "ok")
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: duckdb-${{ env.DUCKDB_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish duckdb ${{ inputs.version || '1.5.5' }} 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: duckdb-${{ env.DUCKDB_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 }}
Loading