-
Notifications
You must be signed in to change notification settings - Fork 0
261 lines (224 loc) · 8.73 KB
/
build-artifacts.yml
File metadata and controls
261 lines (224 loc) · 8.73 KB
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
name: Build and Test
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build-deb:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential debhelper dkms devscripts dh-dkms
- name: Build binary package
run: |
dpkg-buildpackage -us -uc -b
mkdir -p build-output
mv ../*.deb build-output/ || true
mv ../*.buildinfo build-output/ || true
mv ../*.changes build-output/ || true
- name: Build source package
run: |
dpkg-buildpackage -us -uc -S -sa
mkdir -p source-output
mv ../*.dsc source-output/ || true
mv ../*.tar.* source-output/ || true
mv ../*.changes source-output/ || true
- name: List package contents
run: |
echo "=== Built packages ==="
ls -lh build-output/*.deb
echo ""
echo "=== Package contents ==="
dpkg-deb -c build-output/*.deb
- name: Upload Debian package
uses: actions/upload-artifact@v4
with:
name: amdxdna-dkms-deb
path: build-output/*.deb
retention-days: 30
- name: Upload build metadata
if: always()
uses: actions/upload-artifact@v4
with:
name: build-metadata
path: |
build-output/*.buildinfo
build-output/*.changes
retention-days: 7
if-no-files-found: ignore
- name: Upload source package
uses: actions/upload-artifact@v4
with:
name: source-package
path: source-output/*
retention-days: 30
test-kernels:
needs: build-deb
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
kernel:
- name: "OEM 6.17"
package: "linux-headers-oem-24.04d"
- name: "HWE"
package: "linux-headers-generic-hwe-24.04"
name: Test on ${{ matrix.kernel.name }}
steps:
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: amdxdna-dkms-deb
- name: Install kernel headers and build tools
run: |
sudo apt-get update
sudo apt-get install -y dkms build-essential
# Install headers for the kernel we want to test
sudo apt-get install -y ${{ matrix.kernel.package }}
- name: List installed kernels
run: |
echo "=== Installed kernel headers ==="
ls -la /lib/modules/
- name: Install DKMS package
run: |
sudo dpkg -i *.deb || {
echo "Package installation failed, checking dependencies..."
sudo apt-get install -f -y
sudo dpkg -i *.deb
}
# Extract version and trigger DKMS build for the target kernel
VERSION=$(dpkg -I *.deb | grep '^ Version:' | awk '{print $2}' | sed 's/-[0-9]*$//')
TARGET_KERNEL=$(ls /lib/modules/ | grep -v $(uname -r) | head -1)
echo "Triggering DKMS build for kernel: $TARGET_KERNEL"
sudo dkms build amdxdna/$VERSION -k $TARGET_KERNEL || true
sudo dkms install amdxdna/$VERSION -k $TARGET_KERNEL || true
- name: Verify DKMS build
run: |
echo "=== DKMS Status ==="
dkms status amdxdna || true
dkms status || true
echo ""
echo "=== Checking for built modules ==="
ls -la /lib/modules/*/updates/dkms/ 2>/dev/null || echo "No modules in /lib/modules/*/updates/dkms/"
# Extract version from package filename (remove debian revision suffix)
VERSION=$(dpkg -I *.deb | grep '^ Version:' | awk '{print $2}' | sed 's/-[0-9]*$//')
echo ""
echo "Package version: $VERSION"
# Verify module was built
if dkms status amdxdna/$VERSION 2>/dev/null | grep -q "installed"; then
echo "✓ Module successfully built and installed"
else
echo "✗ Module build may have failed, checking logs..."
echo ""
echo "=== DKMS make.log (if exists) ==="
sudo find /var/lib/dkms/amdxdna -name "make.log" -exec tail -50 {} \; 2>/dev/null || echo "No build logs found"
exit 1
fi
- name: Verify firmware installation
run: |
echo "=== Firmware Files ==="
ls -lR /lib/firmware/updates/amdnpu/
echo ""
echo "=== Verify Symlinks ==="
for device in 1502_00 17f0_10 17f0_11; do
if [ -L "/lib/firmware/updates/amdnpu/$device/npu.sbin" ]; then
echo "✓ $device/npu.sbin symlink exists"
else
echo "✗ $device/npu.sbin symlink missing"
exit 1
fi
if [ -L "/lib/firmware/updates/amdnpu/$device/npu_7.sbin" ]; then
echo "✓ $device/npu_7.sbin symlink exists"
else
echo "✗ $device/npu_7.sbin symlink missing"
exit 1
fi
done
- name: Check module info
run: |
echo "=== Module Information ==="
# Find the built module
VERSION=$(dpkg -I *.deb | grep '^ Version:' | awk '{print $2}' | cut -d- -f1)
KERNEL=$(ls /lib/modules/ | grep ${{ matrix.kernel.version }} | head -1)
if [ -n "$KERNEL" ]; then
MODULE_PATH="/lib/modules/$KERNEL/updates/dkms/amdxdna.ko"
if [ -f "$MODULE_PATH" ]; then
modinfo "$MODULE_PATH" || true
else
echo "Module not found at $MODULE_PATH"
fi
else
echo "No matching kernel found in /lib/modules/"
fi
upload-ppa:
needs: test-kernels
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
ubuntu_release: [noble, questing, resolute]
build: [3]
name: Upload to PPA for ${{ matrix.ubuntu_release }}
steps:
- name: Download source package
uses: actions/download-artifact@v4
with:
name: source-package
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y devscripts debhelper dh-dkms dkms
- name: Extract source package
run: |
echo "Extracting source package..."
dpkg-source -x amdxdna-dkms_*.dsc extracted-source
- name: Update changelog for Ubuntu release
working-directory: extracted-source
run: |
# Get current version from changelog
CURRENT_VERSION=$(dpkg-parsechangelog -S Version)
# Remove any existing release suffix (e.g., noble1, questing1)
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/[a-z]*[0-9]*$//')
# Append new release suffix
NEW_VERSION="${BASE_VERSION}${{ matrix.ubuntu_release }}${{ matrix.build }}"
echo "Updating version from $CURRENT_VERSION to $NEW_VERSION"
echo "Targeting Ubuntu ${{ matrix.ubuntu_release }}"
# Update changelog with new version and target release
DEBFULLNAME="AMD XDNA Driver Team" \
DEBEMAIL="xdna-driver@amd.com" \
dch --newversion "$NEW_VERSION" \
--distribution "${{ matrix.ubuntu_release }}" \
--force-distribution \
"Rebuild for Ubuntu ${{ matrix.ubuntu_release }}"
# Update PACKAGE_VERSION in dkms.conf to match the new version
# echo "Updating dkms.conf PACKAGE_VERSION to $NEW_VERSION"
# sed -i "s/^PACKAGE_VERSION=.*/PACKAGE_VERSION=\"$NEW_VERSION\"/" dkms.conf
- name: Rebuild source package
working-directory: extracted-source
run: |
echo "Building source package for ${{ matrix.ubuntu_release }}..."
dpkg-buildpackage -S -d -us -uc
- name: Setup GPG key
run: |
echo "Setting up GPG key..."
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import --batch --yes
# Get the key ID
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | head -1 | awk '{print $2}' | cut -d'/' -f2)
echo "GPG_KEY_ID=$GPG_KEY_ID" >> $GITHUB_ENV
- name: Sign source package
run: |
echo "Signing package with GPG key $GPG_KEY_ID..."
debsign -k $GPG_KEY_ID amdxdna-dkms_*${{ matrix.ubuntu_release }}${{ matrix.build }}_source.changes
- name: Upload to PPA
run: |
echo "Uploading to ppa:amd-team/xrt for ${{ matrix.ubuntu_release }}..."
dput ppa:amd-team/xrt amdxdna-dkms_*${{ matrix.ubuntu_release }}${{ matrix.build }}_source.changes