Skip to content

Commit 379bccb

Browse files
committed
Updated workflow
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
1 parent 430a95c commit 379bccb

File tree

6 files changed

+57
-86
lines changed

6 files changed

+57
-86
lines changed

.github/workflows/amdsmi-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
image: quay.io/pypa/manylinux_2_28_x86_64
3030

3131
steps:
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
3333

3434
- name: Mark workspace safe for git
3535
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
@@ -82,7 +82,7 @@ jobs:
8282
options: --rm --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size=64G --cap-add=SYS_MODULE -v /lib/modules:/lib/modules -u root
8383

8484
steps:
85-
- uses: actions/checkout@v4
85+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
8686

8787
- name: Mark workspace safe for git
8888
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
@@ -408,7 +408,7 @@ jobs:
408408
options: --rm --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size=64G --cap-add=SYS_MODULE -v /lib/modules:/lib/modules -u root
409409

410410
steps:
411-
- uses: actions/checkout@v4
411+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
412412

413413
- name: Mark workspace safe for git
414414
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
Lines changed: 52 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: AMDSMI ManyLinux Wheels
1+
name: AMDSMI Manylinux Wheels
22

33
on:
44
pull_request:
@@ -17,112 +17,88 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
manylinux-wheels:
21-
name: Build Manylinux Wheels
20+
rpm-wheels:
21+
name: Build RPM Wheels (AlmaLinux 8 / manylinux_2_28)
2222
runs-on: ubuntu-latest
2323
container:
2424
image: quay.io/pypa/manylinux_2_28_x86_64
2525

2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2828

2929
- name: Mark workspace safe for git
3030
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
3131

32-
- name: Build manylinux wheels
32+
- name: Build wheels (RPM)
3333
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."
34+
/opt/python/cp38-cp38/bin/python3 \
35+
"$GITHUB_WORKSPACE/projects/amdsmi/tools/build_wheel_rpm.py" \
36+
--project-dir "$GITHUB_WORKSPACE/projects/amdsmi" \
37+
--output-dir "$GITHUB_WORKSPACE/wheels" \
38+
--os-variant AlmaLinux8
39+
40+
- name: Verify wheels exist
41+
run: |
42+
ls -al "$GITHUB_WORKSPACE/wheels"
43+
if ! ls "$GITHUB_WORKSPACE"/wheels/*.whl >/dev/null 2>&1; then
44+
echo "No wheels found; failing."
8845
exit 1
8946
fi
9047
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
48+
- name: Upload RPM wheels (by SHA)
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: amdsmi-rpm-wheels-${{ github.sha }}
52+
path: ${{ github.workspace }}/wheels/*.whl
53+
if-no-files-found: error
54+
retention-days: 30
9755

98-
echo "Final wheels:"
99-
ls -al "$WHEEL_OUT"
56+
- name: Upload RPM wheels (downloadable)
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: amdsmi-rpm-wheels
60+
path: ${{ github.workspace }}/wheels/*.whl
61+
if-no-files-found: warn
62+
retention-days: 90
63+
64+
debian-wheels:
65+
name: Build Debian Wheels (Ubuntu 22.04)
66+
runs-on: ubuntu-22.04
67+
68+
steps:
69+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
70+
71+
- name: Install build prerequisites
72+
run: |
73+
sudo apt-get update
74+
sudo apt-get install -y git make gcc g++ cmake ninja-build libssl-dev
75+
76+
- name: Build wheels (Debian)
77+
run: |
78+
python3 "$GITHUB_WORKSPACE/projects/amdsmi/tools/build_wheel_debian.py" \
79+
--project-dir "$GITHUB_WORKSPACE/projects/amdsmi" \
80+
--output-dir "$GITHUB_WORKSPACE/wheels"
10081
10182
- name: Verify wheels exist
10283
run: |
103-
mkdir -p "$GITHUB_WORKSPACE/wheels"
10484
ls -al "$GITHUB_WORKSPACE/wheels"
10585
if ! ls "$GITHUB_WORKSPACE"/wheels/*.whl >/dev/null 2>&1; then
10686
echo "No wheels found; failing."
10787
exit 1
10888
fi
109-
echo "Wheel summary:"
110-
for whl in "$GITHUB_WORKSPACE"/wheels/*.whl; do
111-
echo " $(basename $whl)"
112-
done
11389
114-
- name: Upload manylinux wheels (by SHA)
90+
- name: Upload Debian wheels (by SHA)
11591
uses: actions/upload-artifact@v4
11692
with:
117-
name: amdsmi-manylinux-wheels-${{ github.sha }}
93+
name: amdsmi-debian-wheels-${{ github.sha }}
11894
path: ${{ github.workspace }}/wheels/*.whl
11995
if-no-files-found: error
12096
retention-days: 30
12197

122-
- name: Upload manylinux wheels (downloadable)
98+
- name: Upload Debian wheels (downloadable)
12399
uses: actions/upload-artifact@v4
124100
with:
125-
name: amdsmi-python-wheels
101+
name: amdsmi-debian-wheels
126102
path: ${{ github.workspace }}/wheels/*.whl
127103
if-no-files-found: warn
128104
retention-days: 90

projects/amdsmi/amdsmi_cli/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
55
# Set CLI Build Directory
66
set(PY_PACKAGE_DIR "amdsmi_cli")
77
set(PY_CLI_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR}" CACHE STRING "CLI tool installation directory")
8-
set(PY_LIB_FROM_PKG "${PROJECT_BINARY_DIR}/py-interface/python_package/amdsmi/libamd_smi_python.so")
98

109
# populate version string
1110
configure_file(_version.py.in ${PY_PACKAGE_DIR}/_version.py @ONLY)

projects/amdsmi/py-interface/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ else()
6666
${PY_PACKAGE_DIR}/amdsmi_wrapper.py
6767
DEPENDS ${AMD_SMI} $<$<BOOL:${BUILD_PYTHON_LIB}>:${AMD_SMI}_python> python_pre_reqs generator.py ${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h
6868
COMMAND cp ${PROJECT_SOURCE_DIR}/include/amd_smi/amdsmi.h ./
69-
COMMAND ${CMAKE_COMMAND} -E env AMDSMI_FIND_LIB_PATH=${CMAKE_CURRENT_BINARY_DIR}/${PY_PACKAGE_DIR}/_find_lib.py
70-
${Python3_EXECUTABLE} generator.py "$<$<BOOL:${ENABLE_ESMI_LIB}>:-e -DENABLE_ESMI_LIB>" -i amdsmi.h -l
69+
COMMAND ${Python3_EXECUTABLE} generator.py "$<$<BOOL:${ENABLE_ESMI_LIB}>:-e -DENABLE_ESMI_LIB>" -i amdsmi.h -l
7170
${AMDSMI_PYTHON_LIB_PATH} -o ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py
7271
COMMAND mkdir -p ${PY_PACKAGE_DIR}
7372
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/amdsmi_wrapper.py ${PY_PACKAGE_DIR}/

projects/amdsmi/py-interface/_find_lib.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def find_smi_library() -> Path:
77
if candidate.exists():
88
return candidate
99
# fall back to the default shared library name for developer builds
10-
return here / "libamd_smi.so"
10+
return here / "libamd_smi.so"

projects/amdsmi/py-interface/amdsmi_wrapper.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ def char_pointer_cast(string, encoding='utf-8'):
191191
# so every downstream ctypes binding in this wrapper works unchanged.
192192
# ---------------------------------------------------------------------------
193193

194-
_libraries = {}
195-
196-
197194
def _detect_install_context():
198195
"""Classify the current install as ``"pip"`` or ``"system"``.
199196

0 commit comments

Comments
 (0)