diff --git a/.github/workflows/build-asyncpg.yml b/.github/workflows/build-asyncpg.yml new file mode 100644 index 00000000..8a4bb4c0 --- /dev/null +++ b/.github/workflows/build-asyncpg.yml @@ -0,0 +1,97 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/MagicStack/asyncpg/blob/v0.31.0/.github/workflows/release.yml +name: Build asyncpg wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'asyncpg version to build (PyPI version, e.g. 0.31.0)' + required: true + default: '0.31.0' + pull_request: + paths: + - '.github/workflows/build-asyncpg.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '0.31.0' }}-${{ 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 0.31.0 there. + ASYNCPG_VERSION: ${{ inputs.version || '0.31.0' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + build_wheels: + name: Build asyncpg ${{ inputs.version || '0.31.0' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: + # Per-interpreter (not abi3): PyPI ships a cpXY-cpXY wheel for each. + python: + - "cp312" + - "cp313" + - "cp314" + - "cp314t" + + steps: + - name: Checkout asyncpg v${{ env.ASYNCPG_VERSION }} + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + repository: MagicStack/asyncpg + ref: v${{ env.ASYNCPG_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 before-all scripts only know debian/almalinux/centos/alpine and + # bail on the Rocky 10 riscv64 image; install the same packages directly. + CIBW_BEFORE_ALL_LINUX: >- + dnf install -y --setopt=install_weak_deps=False + postgresql-server postgresql-contrib libpq-devel + krb5-server krb5-workstation krb5-devel + && useradd -m -s /bin/bash apgtest + # setuptools 82 dropped pkg_resources, which setup.py imports to cythonise; + # pyproject only floors setuptools, so pin it and drop build isolation. + CIBW_BEFORE_BUILD: pip install "setuptools<82" "Cython>=3.2.1,<4.0.0" wheel + CIBW_BUILD_FRONTEND: "build; args: --no-isolation" + # uvloop, in upstream's inherited `test` group, has no riscv64 wheel on PyPI. + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: asyncpg-${{ env.ASYNCPG_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish asyncpg ${{ inputs.version || '0.31.0' }} 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: asyncpg-${{ env.ASYNCPG_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 }}