Skip to content

Commit 78e8a39

Browse files
committed
Added ManyLinux Workflow
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
1 parent 87e9051 commit 78e8a39

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: AMDSMI ManyLinux Wheels
2+
3+
on:
4+
pull_request:
5+
branches: [develop]
6+
paths:
7+
- 'projects/amdsmi/**'
8+
- '.github/workflows/manylinux-build.yml'
9+
push:
10+
branches: [develop]
11+
paths:
12+
- 'projects/amdsmi/**'
13+
- '.github/workflows/manylinux-build.yml'
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
manylinux-wheels:
21+
name: Build Manylinux Wheels
22+
runs-on: ubuntu-latest
23+
container:
24+
image: quay.io/pypa/manylinux_2_28_x86_64
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Mark workspace safe for git
30+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
31+
32+
- name: Build manylinux wheels
33+
run: |
34+
set -euo pipefail
35+
set -x
36+
PROJECT_DIR=$GITHUB_WORKSPACE/projects/amdsmi
37+
BUILD_DIR=/tmp/amdsmi-build
38+
RAW_WHEELS=/tmp/raw-wheels
39+
WHEEL_OUT=$GITHUB_WORKSPACE/wheels
40+
PY_BUILD=/opt/python/cp38-cp38/bin/python3
41+
42+
echo "Using manylinux image: quay.io/pypa/manylinux_2_28_x86_64"
43+
44+
echo "Installing build prerequisites..."
45+
dnf -y install git make gcc gcc-c++ cmake ninja-build openssl-devel
46+
47+
echo "Configuring and building core..."
48+
rm -rf "$BUILD_DIR"
49+
mkdir -p "$BUILD_DIR"
50+
cd "$BUILD_DIR"
51+
cmake "$PROJECT_DIR" \
52+
-DBUILD_TESTS=OFF \
53+
-DENABLE_ESMI_LIB=ON \
54+
-DBUILD_PYTHON_LIB=ON \
55+
-DCMAKE_BUILD_TYPE=Release \
56+
-DPython3_EXECUTABLE="$PY_BUILD"
57+
make -j"$(nproc)"
58+
59+
echo "Building wheels for all supported Python versions..."
60+
mkdir -p "$RAW_WHEELS" "$WHEEL_OUT"
61+
chmod 777 "$WHEEL_OUT"
62+
$PY_BUILD -m pip install --upgrade pip setuptools wheel auditwheel
63+
64+
for PY in \
65+
/opt/python/cp38-cp38/bin/python3 \
66+
/opt/python/cp39-cp39/bin/python3 \
67+
/opt/python/cp310-cp310/bin/python3 \
68+
/opt/python/cp311-cp311/bin/python3 \
69+
/opt/python/cp312-cp312/bin/python3 \
70+
/opt/python/cp313-cp313/bin/python3; do
71+
if [ ! -x "$PY" ]; then
72+
echo "Skipping missing interpreter $PY"
73+
continue
74+
fi
75+
echo "Building wheel with $PY"
76+
$PY -m pip install --upgrade pip setuptools wheel
77+
pushd "$BUILD_DIR/py-interface/python_package"
78+
rm -rf build dist *.whl *.egg-info
79+
$PY -m pip wheel --no-deps --no-build-isolation -w "$RAW_WHEELS" .
80+
popd
81+
done
82+
83+
echo "Raw wheels built:"
84+
ls -al "$RAW_WHEELS" || true
85+
86+
if ! ls "$RAW_WHEELS"/*.whl >/dev/null 2>&1; then
87+
echo "No wheels were built; aborting."
88+
exit 1
89+
fi
90+
91+
echo "Repairing wheels with auditwheel..."
92+
if ! $PY_BUILD -m auditwheel repair "$RAW_WHEELS"/*.whl --wheel-dir "$WHEEL_OUT"; then
93+
echo "auditwheel repair failed; keeping raw wheels only."
94+
cp -v "$RAW_WHEELS"/*.whl "$WHEEL_OUT"/
95+
fi
96+
sync
97+
98+
echo "Final wheels:"
99+
ls -al "$WHEEL_OUT"
100+
101+
- name: Verify wheels exist
102+
run: |
103+
mkdir -p "$GITHUB_WORKSPACE/wheels"
104+
ls -al "$GITHUB_WORKSPACE/wheels"
105+
if ! ls "$GITHUB_WORKSPACE"/wheels/*.whl >/dev/null 2>&1; then
106+
echo "No wheels found; failing."
107+
exit 1
108+
fi
109+
echo "Wheel summary:"
110+
for whl in "$GITHUB_WORKSPACE"/wheels/*.whl; do
111+
echo " $(basename $whl)"
112+
done
113+
114+
- name: Upload manylinux wheels (by SHA)
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: amdsmi-manylinux-wheels-${{ github.sha }}
118+
path: ${{ github.workspace }}/wheels/*.whl
119+
if-no-files-found: error
120+
retention-days: 30
121+
122+
- name: Upload manylinux wheels (downloadable)
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: amdsmi-python-wheels
126+
path: ${{ github.workspace }}/wheels/*.whl
127+
if-no-files-found: warn
128+
retention-days: 90

0 commit comments

Comments
 (0)