This is an automated email from the ASF dual-hosted git repository.
guan404ming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 9b5e312e6 ci(wheel-build): tighten and speed up wheel build workflow
(#1376)
9b5e312e6 is described below
commit 9b5e312e67d5356dfec281417f8dbdff94610b12
Author: Ryan Huang <[email protected]>
AuthorDate: Sat Jun 6 14:10:17 2026 +0800
ci(wheel-build): tighten and speed up wheel build workflow (#1376)
* ci(wheel-build): tighten and speed up wheel build workflow
- Add paths filters so wheel builds only run when qumat/qdp or
packaging files change (website/docs-only PRs skip the CUDA build)
- Add concurrency group to cancel superseded PR runs
- Collapse the 3-version matrix into a single maturin invocation so
the CUDA toolkit and gcc-toolset are installed once instead of 3x
- Remove the silent QDP_NO_CUDA fallback: a green wheel build now
always means real CUDA kernels were compiled (inspection of recent
run logs showed the fallback path has never legitimately fired)
- Validate artifacts before upload: twine check for all dists, plus
import smoke tests (qumat, and each qumat-qdp wheel in a matching
per-version venv asserting the Rust extension loads)
- Define the CUDA version once at the top of the build script
* ci(wheel-build): derive CUDA package version, cover packaged root files
in paths filter
- Derive CUDA_PKG_VER from CUDA_VER so a future CUDA bump cannot
leave the two out of sync
- Add README.md and LICENSE to the paths filters: both are packaged
into the qumat sdist/wheel, so changes to them should run the
build and twine check
* ci(wheel-build): provision smoke-test Pythons via setup-python, trim
comments
Install Python 3.10-3.12 with setup-python so the smoke-test venvs use
deterministic, cached interpreters instead of uv downloading toolchains
at runtime (addresses review feedback).
---
.github/workflows/wheel-build.yml | 78 +++++++++++++++++++++++++++++----------
1 file changed, 59 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/wheel-build.yml
b/.github/workflows/wheel-build.yml
index d78ce766c..1b1137f4f 100644
--- a/.github/workflows/wheel-build.yml
+++ b/.github/workflows/wheel-build.yml
@@ -19,12 +19,32 @@ name: Wheel Build
on:
push:
branches: [main]
+ paths:
+ - "qumat/**"
+ - "qdp/**"
+ - "pyproject.toml"
+ - "uv.lock"
+ - "README.md"
+ - "LICENSE"
+ - ".github/workflows/wheel-build.yml"
pull_request:
+ paths:
+ - "qumat/**"
+ - "qdp/**"
+ - "pyproject.toml"
+ - "uv.lock"
+ - "README.md"
+ - "LICENSE"
+ - ".github/workflows/wheel-build.yml"
workflow_dispatch:
permissions:
contents: read
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
jobs:
# Pure Python wheel (qumat)
build-qumat:
@@ -41,49 +61,69 @@ jobs:
pip install uv
uv build
+ - name: Validate distributions
+ run: uvx twine check dist/*
+
+ - name: Smoke-test wheel
+ run: |
+ uv venv /tmp/qumat-smoke
+ VIRTUAL_ENV=/tmp/qumat-smoke uv pip install dist/*.whl
+ /tmp/qumat-smoke/bin/python -c "import qumat; print('qumat import
OK')"
+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
# v5
with:
name: qumat
path: dist/*
- # CUDA extension wheels (qumat-qdp) for each Python version
+ # CUDA extension wheels (qumat-qdp) for all supported Python versions
build-qdp:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
+ - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #
v6
+ with:
+ python-version: |
+ 3.10
+ 3.11
+ 3.12
+
- uses: PyO3/maturin-action@v1
with:
working-directory: qdp/qdp-python
command: build
target: x86_64
- args: --release --out dist --interpreter python${{
matrix.python-version }}
+ args: --release --out dist -i python3.10 -i python3.11 -i python3.12
manylinux: 2_28
before-script-linux: |
+ CUDA_VER=12.5
+ CUDA_PKG_VER="${CUDA_VER//./-}"
# Install gcc 13 (CUDA 12.5 requires gcc <= 13)
dnf install -y gcc-toolset-13-gcc gcc-toolset-13-gcc-c++
export CC=/opt/rh/gcc-toolset-13/root/usr/bin/gcc
export CXX=/opt/rh/gcc-toolset-13/root/usr/bin/g++
- # Try to install the CUDA 12.5 toolkit for kernel compilation.
- # If the external NVIDIA repo is temporarily unavailable, fall back
- # to a no-CUDA smoke build instead of failing the PR wheel job.
+ # Install the CUDA toolkit for kernel compilation (no fallback)
dnf install -y 'dnf-command(config-manager)'
- if dnf config-manager --add-repo
https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
\
- && dnf install -y cuda-nvcc-12-5 cuda-cudart-devel-12-5; then
- export CUDA_PATH=/usr/local/cuda-12.5
- export PATH=/usr/local/cuda-12.5/bin:$PATH
- nvcc --version
- else
- echo "CUDA repo unavailable; continuing with QDP_NO_CUDA=1 smoke
build."
- export QDP_NO_CUDA=1
- fi
+ dnf config-manager --add-repo
https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
+ dnf install -y cuda-nvcc-${CUDA_PKG_VER}
cuda-cudart-devel-${CUDA_PKG_VER}
+ export CUDA_PATH=/usr/local/cuda-${CUDA_VER}
+ export PATH=/usr/local/cuda-${CUDA_VER}/bin:$PATH
+ nvcc --version
sccache: true
+ - name: Validate and smoke-test wheels
+ working-directory: qdp/qdp-python
+ run: |
+ pip install uv
+ uvx twine check dist/*.whl
+ for py in 3.10 3.11 3.12; do
+ tag="cp${py/./}"
+ uv venv --python "$py" "/tmp/qdp-smoke-$tag"
+ VIRTUAL_ENV="/tmp/qdp-smoke-$tag" uv pip install dist/*"$tag"*.whl
+ "/tmp/qdp-smoke-$tag/bin/python" -c "from qumat_qdp._backend
import get_qdp; assert get_qdp() is not None, 'Rust extension failed to load';
print('$py: qumat_qdp import OK')"
+ done
+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
# v5
with:
- name: qumat-qdp-cp${{ matrix.python-version }}
+ name: qumat-qdp-wheels
path: qdp/qdp-python/dist/*.whl