Skip to content

workflows: migrate canonical cibuildwheel builds #16

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #16

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on the `build_wheels` job of
# https://github.com/ing-bank/sparse_dot_topn/blob/v1.2.0/.github/workflows/wheels.yml
name: Build sparse-dot-topn wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/sparse-dot-topn.yaml not released yet'
required: false
default: ''
cancel-in-progress:
description: Cancel an in-progress run in the same concurrency group.
required: false
type: boolean
default: true
pull_request:
branches: [main]
paths:
- '.github/workflows/build-sparse-dot-topn.yml'
- 'docs/packages/sparse-dot-topn.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-sparse-dot-topn.yml'
- 'docs/packages/sparse-dot-topn.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ case(github.event_name == 'pull_request', true, github.event_name == 'workflow_dispatch', inputs['cancel-in-progress'], false) }}
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: sparse-dot-topn
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build sparse-dot-topn ${{ matrix.version }} cp312-abi3-manylinux_riscv64
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# wheel.py-api = "cp312": cp312 builds the one abi3 wheel, cp313/cp314 re-test it.
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "sparse-dot-topn"
version: "${{ matrix.version }}"
repository: "ing-bank/sparse_dot_topn"
ref: "v${{ matrix.version }}"
artifact-tag: "cp312-abi3-manylinux_riscv64"
checkout-submodules: "true"
cibw-build: "cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64"
cibw-environment-linux: "CMAKE_ARGS=\"-DSDTN_ENABLE_ARCH_FLAGS=OFF -DSDTN_ENABLE_OPENMP=ON -DSDTN_DISABLE_OPENMP=OFF\" PIP_ONLY_BINARY=numpy,scipy,psutil"
cibw-test-command: "pytest {project}/tests && python -c \"from sparse_dot_topn import _has_openmp_support;assert _has_openmp_support\""
gpl_sources:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Collect GPL sources
runs-on: ubuntu-24.04-riscv
env:
SPARSE_DOT_TOPN_VERSION: ${{ matrix.version }}
steps:
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# SDTN_ENABLE_OPENMP links libgomp, which auditwheel vendors into sparse_dot_topn.libs/.
- uses: ./actions/collect-gpl-sources
with:
image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
packages: gcc
output: gpl-sources.tar
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sparse-dot-topn-${{ env.SPARSE_DOT_TOPN_VERSION }}-gpl-sources
path: gpl-sources.tar
if-no-files-found: error
publish:
name: Publish sparse-dot-topn ${{ matrix.version }}
needs: [setup, build_wheels, gpl_sources]
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:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: sparse-dot-topn-${{ matrix.version }}-*-manylinux_riscv64
gpl-sources-artifact: sparse-dot-topn-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc