-
Notifications
You must be signed in to change notification settings - Fork 34
380 lines (329 loc) · 16.1 KB
/
amdsmi-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
name: Build and Install AMDSMI
on:
pull_request:
branches: [amd-staging, amd-mainline, release/rocm-rel-*]
push:
branches: [amd-staging, amd-mainline, release/rocm-rel-*]
workflow_dispatch:
jobs:
build-and-install-deb:
name: Build on Debian-based Systems
runs-on:
- self-hosted
- ${{ vars.RUNNER_TYPE }}
continue-on-error: true
strategy:
matrix:
os:
- Ubuntu20
- Ubuntu22
- Debian10
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
clean: false
- name: Set Docker Image for Ubuntu20
if: matrix.os == 'Ubuntu20'
run: echo "DOCKER_IMAGE=${{ secrets.UBUNTU20_DOCKER_IMAGE }}" >> $GITHUB_ENV
- name: Set Docker Image for Ubuntu22
if: matrix.os == 'Ubuntu22'
run: echo "DOCKER_IMAGE=${{ secrets.UBUNTU22_DOCKER_IMAGE }}" >> $GITHUB_ENV
- name: Set Docker Image for Debian10
if: matrix.os == 'Debian10'
run: echo "DOCKER_IMAGE=${{ secrets.DEBIAN10_DOCKER_IMAGE }}" >> $GITHUB_ENV
- name: Generate Timestamp
id: timestamp
run: echo "TIMESTAMP=$(date +'%b %d %Y %-I:%M %p')" >> $GITHUB_ENV
- name: Build, Install & Uninstall on ${{ matrix.os }} at ${{ env.TIMESTAMP }}
run: |
# Define a host directory for test results
HOST_TEST_RESULTS_DIR=/tmp/test-results
# Ensure the host directory exists
mkdir -p $HOST_TEST_RESULTS_DIR
docker run --privileged -v ${{ github.workspace }}:/src:rw -v $HOST_TEST_RESULTS_DIR:/shared:rw $DOCKER_IMAGE /bin/bash -c "
set -e
cd /src
echo 'Inside Docker Container on ${{ matrix.os }}'
# Build AMD-SMI
BUILD_FOLDER=/src/build
DEB_BUILD='amd-smi-lib*99999-local_amd64.deb'
DEB_BUILD_TEST='amd-smi-lib-tests*99999-local_amd64.deb'
rm -rf \$BUILD_FOLDER
mkdir -p \$BUILD_FOLDER
cd \$BUILD_FOLDER
cmake .. -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON
make -j \$(nproc)
make package
# Install AMD-SMI
apt update
apt install -y \$BUILD_FOLDER/\$DEB_BUILD
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
# Check If Installed
echo 'Listing installed packages:'
amd-smi version
python3 -m pip list | grep amd
python3 -m pip list | grep pip
python3 -m pip list | grep setuptools
echo 'Completed build and installation on ${{ matrix.os }}'
# Create the directory for test results
mkdir -p /shared/test-results-${{ matrix.os }}
# Parse and explain test results
parse_and_explain() {
local log_file=\$1
local test_name=\$2
if grep -q 'FAILED' \"\$log_file\"; then
echo \"\$test_name failed. Check the log file for details: \$log_file\"
# Add more specific parsing and explanations here
if grep -q 'specific error message' \"\$log_file\"; then
echo 'Explanation: Specific error message encountered.'
fi
else
echo \"\$test_name passed.\"
fi
}
# Run AMDSMI Tests
echo 'Running AMDSMI Tests'
/opt/rocm/share/amd_smi/tests/amdsmitst > /shared/test-results-${{ matrix.os }}/amdsmi_tests.log 2>&1
parse_and_explain /shared/test-results-${{ matrix.os }}/amdsmi_tests.log 'AMDSMI Tests'
echo 'Completed AMDSMI Testing'
# Run Python Unit Tests
echo 'Running Python Unit Testing'
cd /opt/rocm/share/amd_smi/tests/python_unittest
./integration_test.py -v > /shared/test-results-${{ matrix.os }}/integration_test_output.txt 2>&1
parse_and_explain /shared/test-results-${{ matrix.os }}/integration_test_output.txt 'Python Integration Tests'
./unit_tests.py -v > /shared/test-results-${{ matrix.os }}/unit_test_output.txt 2>&1
parse_and_explain /shared/test-results-${{ matrix.os }}/unit_test_output.txt 'Python Unit Tests'
echo 'Completed Python Unit Testing'
# Run Build Testing
echo 'Running Build Tests'
cd /src/build/example
./amd_smi_drm_ex > /shared/test-results-${{ matrix.os }}/amd_smi_drm_ex.log 2>&1 || echo 'amd_smi_drm_ex failed'
parse_and_explain /shared/test-results-${{ matrix.os }}/amd_smi_drm_ex.log 'DRM Example Test'
./amd_smi_esmi_ex > /shared/test-results-${{ matrix.os }}/amd_smi_esmi_ex.log 2>&1 || echo 'amd_smi_esmi_ex failed'
parse_and_explain /shared/test-results-${{ matrix.os }}/amd_smi_esmi_ex.log 'ESMI Example Test'
./amd_smi_nodrm_ex > /shared/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log 2>&1 || echo 'amd_smi_nodrm_ex failed'
parse_and_explain /shared/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log 'No DRM Example Test'
echo 'Completed Build Testing'
# Uninstall AMD-SMI
echo 'Uninstalling AMD-SMI'
sudo apt remove -y amd-smi-lib
sudo rm -f /usr/local/bin/amd-smi
echo 'Successfully Completed uninstallation on ${{ matrix.os }}'
"
- name: Debug Test Results Directory
run: |
echo "Checking test results directory for ${{ matrix.os }}"
ls -R /tmp/test-results || echo "Test results directory not found"
- name: AMDSMI Test Results
run: |
echo "Displaying AMDSMI test results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amdsmi_tests.log || echo "No amdsmi test results found for ${{ matrix.os }}"
- name: Integration Test Results
run: |
echo "Displaying Integration test results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/integration_test_output.txt || echo "No integration test results found for ${{ matrix.os }}"
- name: Unit Test Results
run: |
echo "Displaying Unit Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/unit_test_output.txt || echo "No unit test results found for ${{ matrix.os }}"
- name: DRM EX Test Results
run: |
echo "Displaying DRM EX Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amd_smi_drm_ex.log || echo "No amd_smi_drm_ex.log found for ${{ matrix.os }}"
- name: NO-DRM EX Test Results
run: |
echo "Displaying NO-DRM EX Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log || echo "No amd_smi_nodrm_ex.log found for ${{ matrix.os }}"
- name: ESMI EX Test Results
run: |
echo "Displaying ESMI EX Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amd_smi_esmi_ex.log || echo "No amd_smi_esmi_ex.log found for ${{ matrix.os }}"
build-and-install-rpm:
name: Build on RPM-based Systems
runs-on:
- self-hosted
- ${{ vars.RUNNER_TYPE }}
continue-on-error: true
strategy:
matrix:
os:
- SLES
- RHEL8
- RHEL9
- Mariner2
- AzureLinux3
- AlmaLinux8
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
clean: false
- name: Set Docker Image and Package Manager for SLES
if: matrix.os == 'SLES'
run: |
echo "DOCKER_IMAGE=${{ secrets.SLES_DOCKER_IMAGE }}" >> $GITHUB_ENV
echo "PACKAGE_MANAGER=zypper" >> $GITHUB_ENV
- name: Set Docker Image and Package Manager for RHEL8
if: matrix.os == 'RHEL8'
run: |
echo "DOCKER_IMAGE=${{ secrets.RHEL8_DOCKER_IMAGE }}" >> $GITHUB_ENV
echo "PACKAGE_MANAGER=dnf" >> $GITHUB_ENV
- name: Set Docker Image and Package Manager for RHEL9
if: matrix.os == 'RHEL9'
run: |
echo "DOCKER_IMAGE=${{ secrets.RHEL9_DOCKER_IMAGE }}" >> $GITHUB_ENV
echo "PACKAGE_MANAGER=dnf" >> $GITHUB_ENV
- name: Set Docker Image and Package Manager for Mariner2
if: matrix.os == 'Mariner2'
run: |
echo "DOCKER_IMAGE=${{ secrets.MARINER2_DOCKER_IMAGE }}" >> $GITHUB_ENV
echo "PACKAGE_MANAGER=tdnf" >> $GITHUB_ENV
- name: Set Docker Image and Package Manager for AzureLinux3
if: matrix.os == 'AzureLinux3'
run: |
echo "DOCKER_IMAGE=${{ secrets.AZURELINUX3_DOCKER_IMAGE }}" >> $GITHUB_ENV
echo "PACKAGE_MANAGER=tdnf" >> $GITHUB_ENV
- name: Set Docker Image and Package Manager for AlmaLinux8
if: matrix.os == 'AlmaLinux8'
run: |
echo "DOCKER_IMAGE=${{ secrets.ALMALINUX8_DOCKER_IMAGE }}" >> $GITHUB_ENV
echo "PACKAGE_MANAGER=dnf" >> $GITHUB_ENV
- name: Generate Timestamp
id: timestamp
run: echo "TIMESTAMP=$(date +'%b %d %Y %-I:%M %p')" >> $GITHUB_ENV
- name: Build and Install on ${{ matrix.os }} at ${{ env.TIMESTAMP }}
run: |
# Define a host directory for test results
HOST_TEST_RESULTS_DIR=/tmp/test-results
# Ensure the host directory exists
mkdir -p $HOST_TEST_RESULTS_DIR
docker run --privileged -v ${{ github.workspace }}:/src:rw -v $HOST_TEST_RESULTS_DIR:/shared:rw $DOCKER_IMAGE /bin/bash -c "
set -e
cd /src
echo 'Inside Docker Container on ${{ matrix.os }}'
# Build AMD-SMI
BUILD_FOLDER=/src/build
RPM_BUILD='amd-smi-lib-*99999-local*.rpm'
rm -rf \$BUILD_FOLDER
mkdir -p \$BUILD_FOLDER
cd \$BUILD_FOLDER
cmake .. -DCPACK_RPM_PACKAGE_RELOCATABLE=ON -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON
make -j \$(nproc)
make package
# Adjust permissions of the build directory
chmod -R a+rw \$BUILD_FOLDER
# Install AMD-SMI
case '$PACKAGE_MANAGER' in
zypper)
timeout 10m sudo zypper --no-refresh --no-gpg-checks install -y \$BUILD_FOLDER/\$RPM_BUILD
;;
dnf)
dnf install python3-setuptools python3-wheel -y
timeout 10m dnf install -y --skip-broken --disablerepo=* \$BUILD_FOLDER/\$RPM_BUILD
;;
tdnf)
tdnf install python3-setuptools python3-wheel -y
python3 -m pip install more_itertools
timeout 10m tdnf install -y --skip-broken --disablerepo=* \$BUILD_FOLDER/\$RPM_BUILD
;;
*)
echo 'Unsupported package manager: $PACKAGE_MANAGER'
exit 1
;;
esac
ln -s /opt/rocm/bin/amd-smi /usr/local/bin
# Check If Installed
echo 'Listing installed packages:'
amd-smi version
python3 -m pip list | grep amd
python3 -m pip list | grep pip
python3 -m pip list | grep setuptools
echo 'Completed build and installation on ${{ matrix.os }}'
# Create the directory for test results
mkdir -p /shared/test-results-${{ matrix.os }}
# Parse and explain test results
parse_and_explain() {
local log_file=\$1
local test_name=\$2
if grep -q 'FAILED' \"\$log_file\"; then
echo \"\$test_name failed. Check the log file for details: \$log_file\"
# Add more specific parsing and explanations here
if grep -q 'specific error message' \"\$log_file\"; then
echo 'Explanation: Specific error message encountered.'
fi
else
echo \"\$test_name passed.\"
fi
}
# Run AMDSMI Tests
echo 'Running AMDSMI Tests'
/opt/rocm/share/amd_smi/tests/amdsmitst > /shared/test-results-${{ matrix.os }}/amdsmi_tests.log 2>&1
parse_and_explain /shared/test-results-${{ matrix.os }}/amdsmi_tests.log 'AMDSMI Tests'
echo 'Completed AMDSMI Testing'
# Run Python Unit Tests
echo 'Running Python Unit Testing'
cd /opt/rocm/share/amd_smi/tests/python_unittest
./integration_test.py -v > /shared/test-results-${{ matrix.os }}/integration_test_output.txt 2>&1
parse_and_explain /shared/test-results-${{ matrix.os }}/integration_test_output.txt 'Python Integration Tests'
./unit_tests.py -v > /shared/test-results-${{ matrix.os }}/unit_test_output.txt 2>&1
parse_and_explain /shared/test-results-${{ matrix.os }}/unit_test_output.txt 'Python Unit Tests'
echo 'Completed Python Unit Testing'
# Run Build Testing
echo 'Running Build Tests'
cd /src/build/example
./amd_smi_drm_ex > /shared/test-results-${{ matrix.os }}/amd_smi_drm_ex.log 2>&1 || echo 'amd_smi_drm_ex failed'
parse_and_explain /shared/test-results-${{ matrix.os }}/amd_smi_drm_ex.log 'DRM Example Test'
./amd_smi_esmi_ex > /shared/test-results-${{ matrix.os }}/amd_smi_esmi_ex.log 2>&1 || echo 'amd_smi_esmi_ex failed'
parse_and_explain /shared/test-results-${{ matrix.os }}/amd_smi_esmi_ex.log 'ESMI Example Test'
./amd_smi_nodrm_ex > /shared/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log 2>&1 || echo 'amd_smi_nodrm_ex failed'
parse_and_explain /shared/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log 'No DRM Example Test'
echo 'Completed Build Testing'
# Uninstall AMD-SMI
echo 'Uninstalling AMD-SMI'
case '$PACKAGE_MANAGER' in
zypper)
zypper remove -y amd-smi-lib
;;
dnf)
dnf remove -y amd-smi-lib
;;
tdnf)
tdnf remove -y amd-smi-lib
;;
*)
echo 'Unsupported package manager: $PACKAGE_MANAGER'
exit 1
;;
esac
rm -f /usr/local/bin/amd-smi
echo 'Successfully Completed uninstallation on ${{ matrix.os }}'
"
- name: Debug Test Results Directory
run: |
echo "Checking test results directory for ${{ matrix.os }}"
ls -R /tmp/test-results || echo "Test results directory not found"
- name: AMDSMI Test Results
run: |
echo "Displaying AMDSMI test results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amdsmi_tests.log || echo "No amdsmi test results found for ${{ matrix.os }}"
- name: Python Integration Test Results
run: |
echo "Displaying Integration test results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/integration_test_output.txt || echo "No integration test results found for ${{ matrix.os }}"
- name: Python Unit Test Results
run: |
echo "Displaying Unit Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/unit_test_output.txt || echo "No unit test results found for ${{ matrix.os }}"
- name: DRM EX Test Results
run: |
echo "Displaying DRM EX Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amd_smi_drm_ex.log || echo "No amd_smi_drm_ex.log found for ${{ matrix.os }}"
- name: NO-DRM EX Test Results
run: |
echo "Displaying NO-DRM EX Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amd_smi_nodrm_ex.log || echo "No amd_smi_nodrm_ex.log found for ${{ matrix.os }}"
- name: ESMI EX Test Results
run: |
echo "Displaying ESMI EX Test Results for ${{ matrix.os }}"
cat /tmp/test-results/test-results-${{ matrix.os }}/amd_smi_esmi_ex.log || echo "No amd_smi_esmi_ex.log found for ${{ matrix.os }}"