Skip to content
Draft
Show file tree
Hide file tree
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
125 changes: 125 additions & 0 deletions .github/workflows/build-asyncdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `build` job of
# https://github.com/phenobarbital/asyncdb/blob/2.16.3/.github/workflows/release.yml
name: Build asyncdb wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/asyncdb.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-asyncdb.yml'
- 'docs/packages/asyncdb.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-asyncdb.yml'
- 'docs/packages/asyncdb.yaml'

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

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

jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: asyncdb
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build asyncdb ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# No cp314t: upstream pins Cython==3.0.11, which cannot compile for free-threaded CPython.
python: ["cp312", "cp313", "cp314"]

env:
ASYNCDB_VERSION: ${{ matrix.version }}

steps:
# Upstream's tree carries a gitlink with no corresponding .gitmodules entry
# (libraries/python-driver), which makes actions/checkout's own
# persist-credentials cleanup (`git submodule foreach`) fail with "No url
# found for submodule path"; plain git sidesteps that internal routine.
- name: Checkout asyncdb ${{ env.ASYNCDB_VERSION }}
run: |
set -euo pipefail
shopt -s dotglob
rm -rf ./*
git init -q .
git remote add origin https://github.com/phenobarbital/asyncdb
git fetch -q --depth=1 origin "$ASYNCDB_VERSION"
git checkout -q FETCH_HEAD

- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: dist
only: ${{ matrix.python }}-manylinux_riscv64

- name: Verify wheel tags and compiled Cython extension
env:
EXPECTED_CPYTHON_TAG: ${{ matrix.python }}
run: |
python3 - <<'EOF'
import glob, os, zipfile

wheels = glob.glob("dist/*.whl")
assert wheels, "no wheels were produced in dist/"

found_cpython_tags = set()
for whl in wheels:
filename = whl.rsplit("/", 1)[-1]
python_tag, _abi_tag, platform_tag = filename[:-4].split("-")[-3:]
found_cpython_tags.add(python_tag)
assert platform_tag.endswith("_riscv64"), (
f"unexpected platform tag for {whl}: {platform_tag}"
)
names = zipfile.ZipFile(whl).namelist()
ext = [n for n in names
if n.startswith("asyncdb/utils/types.") and n.endswith(".so")]
assert ext, f"compiled Cython extension (.so) missing in {whl}"
print(f"OK {whl}: {ext[0]} [{python_tag}-{platform_tag}]")

assert found_cpython_tags == {os.environ["EXPECTED_CPYTHON_TAG"]}, found_cpython_tags
EOF

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

publish:
name: Publish asyncdb ${{ 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: asyncdb-${{ matrix.version }}-*-manylinux_riscv64
5 changes: 5 additions & 0 deletions docs/packages/asyncdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-name: asyncdb
source-code: https://github.com/phenobarbital/asyncdb
license: BSD-3-Clause
versions:
- version: 2.16.3
Loading