PyPi Wheel Generation #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AMDSMI ManyLinux Wheels | |
| on: | |
| pull_request: | |
| branches: [develop] | |
| paths: | |
| - 'projects/amdsmi/**' | |
| - '.github/workflows/manylinux-build.yml' | |
| push: | |
| branches: [develop] | |
| paths: | |
| - 'projects/amdsmi/**' | |
| - '.github/workflows/manylinux-build.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| manylinux-wheels: | |
| name: Build Manylinux Wheels | |
| runs-on: ubuntu-latest | |
| container: | |
| image: quay.io/pypa/manylinux_2_28_x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Mark workspace safe for git | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Build manylinux wheels | |
| run: | | |
| set -euo pipefail | |
| set -x | |
| PROJECT_DIR=$GITHUB_WORKSPACE/projects/amdsmi | |
| BUILD_DIR=/tmp/amdsmi-build | |
| RAW_WHEELS=/tmp/raw-wheels | |
| WHEEL_OUT=$GITHUB_WORKSPACE/wheels | |
| PY_BUILD=/opt/python/cp38-cp38/bin/python3 | |
| echo "Using manylinux image: quay.io/pypa/manylinux_2_28_x86_64" | |
| echo "Installing build prerequisites..." | |
| dnf -y install git make gcc gcc-c++ cmake ninja-build openssl-devel | |
| echo "Configuring and building core..." | |
| rm -rf "$BUILD_DIR" | |
| mkdir -p "$BUILD_DIR" | |
| cd "$BUILD_DIR" | |
| cmake "$PROJECT_DIR" \ | |
| -DBUILD_TESTS=OFF \ | |
| -DENABLE_ESMI_LIB=ON \ | |
| -DBUILD_PYTHON_LIB=ON \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPython3_EXECUTABLE="$PY_BUILD" | |
| make -j"$(nproc)" | |
| echo "Building wheels for all supported Python versions..." | |
| mkdir -p "$RAW_WHEELS" "$WHEEL_OUT" | |
| chmod 777 "$WHEEL_OUT" | |
| $PY_BUILD -m pip install --upgrade pip setuptools wheel auditwheel | |
| for PY in \ | |
| /opt/python/cp38-cp38/bin/python3 \ | |
| /opt/python/cp39-cp39/bin/python3 \ | |
| /opt/python/cp310-cp310/bin/python3 \ | |
| /opt/python/cp311-cp311/bin/python3 \ | |
| /opt/python/cp312-cp312/bin/python3 \ | |
| /opt/python/cp313-cp313/bin/python3; do | |
| if [ ! -x "$PY" ]; then | |
| echo "Skipping missing interpreter $PY" | |
| continue | |
| fi | |
| echo "Building wheel with $PY" | |
| $PY -m pip install --upgrade pip setuptools wheel | |
| pushd "$BUILD_DIR/py-interface/python_package" | |
| rm -rf build dist *.whl *.egg-info | |
| $PY -m pip wheel --no-deps --no-build-isolation -w "$RAW_WHEELS" . | |
| popd | |
| done | |
| echo "Raw wheels built:" | |
| ls -al "$RAW_WHEELS" || true | |
| if ! ls "$RAW_WHEELS"/*.whl >/dev/null 2>&1; then | |
| echo "No wheels were built; aborting." | |
| exit 1 | |
| fi | |
| echo "Repairing wheels with auditwheel..." | |
| if ! $PY_BUILD -m auditwheel repair "$RAW_WHEELS"/*.whl --wheel-dir "$WHEEL_OUT"; then | |
| echo "auditwheel repair failed; keeping raw wheels only." | |
| cp -v "$RAW_WHEELS"/*.whl "$WHEEL_OUT"/ | |
| fi | |
| sync | |
| echo "Final wheels:" | |
| ls -al "$WHEEL_OUT" | |
| - name: Verify wheels exist | |
| run: | | |
| mkdir -p "$GITHUB_WORKSPACE/wheels" | |
| ls -al "$GITHUB_WORKSPACE/wheels" | |
| if ! ls "$GITHUB_WORKSPACE"/wheels/*.whl >/dev/null 2>&1; then | |
| echo "No wheels found; failing." | |
| exit 1 | |
| fi | |
| echo "Wheel summary:" | |
| for whl in "$GITHUB_WORKSPACE"/wheels/*.whl; do | |
| echo " $(basename $whl)" | |
| done | |
| - name: Upload manylinux wheels (by SHA) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: amdsmi-manylinux-wheels-${{ github.sha }} | |
| path: ${{ github.workspace }}/wheels/*.whl | |
| if-no-files-found: error | |
| retention-days: 30 | |
| - name: Upload manylinux wheels (downloadable) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: amdsmi-python-wheels | |
| path: ${{ github.workspace }}/wheels/*.whl | |
| if-no-files-found: warn | |
| retention-days: 90 |