11# This workflow builds and publishes Python distributions to PyPI.
22# It uses a self-hosted runner and a PyTorch container image
33# to ensure the correct CUDA environment is available for the build.
4+ # It relies on Trusted Publishing for secure authentication with PyPI.
45
56name : Build and Publish Python 🐍 distributions
67
3536 - name : Install build dependencies
3637 run : |
3738 apt-get update
38- apt-get install -y --no-install-recommends build-essential curl libssl-dev pkg-config
39+ apt-get install -y --no-install-recommends build-essential curl libssl-dev pkg-config zip
3940 shell : bash
4041
4142 - name : Install Rust
@@ -60,14 +61,24 @@ jobs:
6061 echo "CUDA_LIB_DIR=$LIB_DIR" >> $GITHUB_ENV
6162 shell : bash
6263
63- - name : Build wheel
64+ - name : Build wheel with auditwheel exclusions
6465 env :
6566 LD_LIBRARY_PATH : ${{ env.CUDA_LIB_DIR }}:${LD_LIBRARY_PATH}
6667 CUDA_COMPUTE_CAP : ${{ matrix.variant.compute-caps }}
6768 AUDITWHEEL_EXCLUDE : " libcuda.so,libnvJitLink.so,libcudart.so,libcublas.so,libcufft.so,libcurand.so,libcusolver.so,libcusparse.so,libcudnn.so"
6869 run : maturin build --release --out dist
6970 shell : bash
7071
72+ - name : Verify wheel contents and size
73+ run : |
74+ echo "--- Verifying wheel contents ---"
75+ WHEEL_FILE=$(ls dist/*.whl)
76+ unzip -l $WHEEL_FILE | grep '\.so'
77+ echo "--- Verifying wheel size ---"
78+ ls -lh dist
79+ # Optionally, fail the build if the wheel is still too large
80+ # find dist -size +95M -exec echo "::error::Wheel size exceeds 95MB" \; -exec exit 1 \;
81+
7182 - name : Upload wheel artifact
7283 uses : actions/upload-artifact@v4
7384 with :
89100 path : dist
90101 merge-multiple : true
91102
92- - name : Publish to PyPI
103+ - name : Publish to PyPI using Trusted Publishing
93104 uses : pypa/gh-action-pypi-publish@v1.12.4
94- with :
95- user : __token__
96- password : ${{ secrets.PYPI_API_TOKEN }}
97- skip-existing : true
0 commit comments