-
Notifications
You must be signed in to change notification settings - Fork 0
459 lines (389 loc) · 14.2 KB
/
release.yml
File metadata and controls
459 lines (389 loc) · 14.2 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
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
name: Release Binary Build
on:
push:
tags:
- 'v*'
branches:
- 'mac-binary-02'
workflow_dispatch:
jobs:
build-linux:
name: Build Linux Release
# Use ubuntu-latest (currently 24.04) to build with modern toolchain
# Bundle dependencies and test on multiple distros to ensure compatibility
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build \
libspdlog-dev \
libglfw3 libglfw3-dev libvulkan-dev \
glslang-tools glslang-dev libglm-dev \
pkg-config \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev patchelf
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wno-error=array-bounds" -G Ninja .
- name: Build
run: cmake --build build
- name: Show libraries before bundling
run: |
echo "📋 Libraries linked BEFORE bundling/patching:"
ldd build/vsdf
- name: Bundle dependencies and fix paths
run: |
mkdir -p release/linux/libs
cp build/vsdf release/linux/
chmod +x release/linux/vsdf
echo "Finding and copying non-system libraries..."
# Find and copy all non-system libraries
ldd build/vsdf | grep -v 'linux-vdso\|libc\.so\|libm\.so\|libpthread\|libdl\|librt\|libstdc++\|libgcc\|/lib/ld-' | grep '=>' | awk '{print $3}' | grep '^/' > /tmp/libs_to_copy.txt
cat /tmp/libs_to_copy.txt | while read lib; do
if [ -f "$lib" ]; then
libname=$(basename "$lib")
echo " → Copying $libname"
cp "$lib" release/linux/libs/ 2>/dev/null || true
fi
done
BUNDLED_COUNT=$(ls release/linux/libs/*.so* 2>/dev/null | wc -l)
echo "Total libraries bundled: $BUNDLED_COUNT"
echo "Setting RPATH..."
# Set RPATH on main binary to look in libs/ folder
patchelf --set-rpath '$ORIGIN/libs' release/linux/vsdf
# Fix RPATH for each bundled library
for lib in release/linux/libs/*.so*; do
[ -f "$lib" ] && patchelf --set-rpath '$ORIGIN' "$lib" 2>/dev/null || true
done
echo "✓ Bundling complete"
echo ""
echo "📦 Binary info:"
file release/linux/vsdf
ls -lh release/linux/vsdf
echo ""
echo "🔗 RPATH configuration:"
patchelf --print-rpath release/linux/vsdf
echo ""
echo "📚 Bundled libraries:"
ls -lh release/linux/libs/
echo ""
echo "🔍 Binary dependencies after bundling:"
ldd release/linux/vsdf
echo ""
echo "⚠️ Checking for missing dependencies:"
if ldd release/linux/vsdf | grep 'not found'; then
echo "❌ ERROR: Missing dependencies found!"
exit 1
else
echo "✅ No missing dependencies"
fi
- name: Package binary
run: |
cp -r shaders release/linux/
cp README.md release/linux/
cp LICENSE release/linux/
cd release
tar -czf vsdf-linux-x86_64.tar.gz linux/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vsdf-linux-x86_64
path: release/vsdf-linux-x86_64.tar.gz
test-linux-ubuntu-24:
name: Test on Ubuntu 24.04
needs: build-linux
runs-on: ubuntu-latest
timeout-minutes: 5
env:
VK_ICD_FILENAMES: /usr/share/vulkan/icd.d/lvp_icd.x86_64.json
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vsdf-linux-x86_64
- name: Extract binary
run: |
tar -xzf vsdf-linux-x86_64.tar.gz
cd linux
chmod +x vsdf
- name: Install runtime dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
xvfb mesa-vulkan-drivers \
libglfw3 libvulkan1 \
libavcodec60 libavformat60 libavutil58 libswscale7
- name: Test version
run: |
cd linux
echo "→ Testing --version..."
./vsdf --version
echo "✓ --version works"
- name: Test 1-frame headless render
run: |
cd linux
echo "→ Testing 1-frame headless render (requires Vulkan)..."
xvfb-run -s '-screen 0 1024x768x24' \
./vsdf --toy shaders/testtoyshader.frag --frames 1 --headless --log-level info
echo "✓ Headless render works"
- name: Test offline render
run: |
cd linux
echo "→ Testing offline render (FFmpeg, requires Vulkan)..."
xvfb-run -s '-screen 0 1024x768x24' \
./vsdf --toy shaders/testtoyshader.frag --frames 10 --ffmpeg-output out-test.mp4 --log-level info
if [ -f out-test.mp4 ]; then
echo "✓ Offline render works (created out-test.mp4)"
rm -f out-test.mp4
else
echo "❌ Failed to create out-test.mp4"
exit 1
fi
test-linux-debian-13:
name: Test on Debian 13 (Trixie)
needs: build-linux
runs-on: ubuntu-latest
timeout-minutes: 5
container:
image: debian:trixie
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vsdf-linux-x86_64
- name: Extract binary
run: |
tar -xzf vsdf-linux-x86_64.tar.gz
cd linux
chmod +x vsdf
- name: Install runtime dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
xvfb xauth mesa-vulkan-drivers \
libglfw3 libvulkan1 \
libavcodec61 libavformat61 libavutil59 libswscale8
- name: Test version
run: |
cd linux
echo "→ Testing --version..."
./vsdf --version
echo "✓ --version works"
build-macos:
name: Build macOS ${{ matrix.arch }} Release
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
strategy:
matrix:
include:
- arch: x86_64
runner: macos-15-intel
- arch: arm64
runner: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
brew install glfw glslang spdlog glm vulkan-tools ffmpeg pkg-config
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DCMAKE_CXX_FLAGS="-Wno-error=sign-conversion -Wno-error=implicit-int-conversion" .
- name: Build
run: cmake --build build
- name: Bundle dependencies and fix paths
run: |
# Create libs directory
mkdir -p release/macos/libs
# Copy the binary
cp build/vsdf release/macos/
echo "📋 Libraries linked BEFORE bundling:"
otool -L build/vsdf
echo ""
# Recursively find and copy all non-system dylibs
echo "🔍 Finding and bundling dynamic libraries..."
# Function to copy a library and its dependencies
copy_lib_recursive() {
local lib="$1"
local libname=$(basename "$lib")
# Skip if already copied
if [ -f "release/macos/libs/$libname" ]; then
return
fi
# Skip system libraries
if [[ "$lib" == /System/* ]] || [[ "$lib" == /usr/lib/* ]] || [[ "$lib" == /Library/Apple/* ]]; then
return
fi
# Copy the library
if [ -f "$lib" ]; then
echo " → Copying $libname"
cp "$lib" release/macos/libs/
# Recursively copy dependencies of this library
otool -L "$lib" | tail -n +2 | awk '{print $1}' | while read -r dep; do
if [ -f "$dep" ]; then
copy_lib_recursive "$dep"
fi
done
fi
}
# Get initial list of libraries from the binary
otool -L build/vsdf | tail -n +2 | awk '{print $1}' | while read -r lib; do
if [ -f "$lib" ]; then
copy_lib_recursive "$lib"
fi
done
BUNDLED_COUNT=$(ls release/macos/libs/*.dylib 2>/dev/null | wc -l | xargs)
echo ""
echo "Total libraries bundled: $BUNDLED_COUNT"
echo ""
# Fix all library paths to use @rpath
echo "🔧 Fixing library paths..."
# Set rpath on the binary to look in libs/ folder next to the executable
# Only add if it doesn't already exist
if ! otool -l release/macos/vsdf | grep -q "@executable_path/libs"; then
echo " Adding @executable_path/libs to rpath"
install_name_tool -add_rpath "@executable_path/libs" release/macos/vsdf
else
echo " @executable_path/libs already in rpath"
fi
# Fix paths in the main binary
for lib in release/macos/libs/*.dylib; do
libname=$(basename "$lib")
# Find the original path in the binary
ORIG_PATH=$(otool -L release/macos/vsdf | grep "$libname" | awk '{print $1}')
if [ ! -z "$ORIG_PATH" ]; then
echo " Fixing $libname in vsdf: $ORIG_PATH -> @rpath/$libname"
install_name_tool -change "$ORIG_PATH" "@rpath/$libname" release/macos/vsdf
fi
done
# Fix inter-library dependencies
for lib in release/macos/libs/*.dylib; do
libname=$(basename "$lib")
# Fix the library's own id
install_name_tool -id "@rpath/$libname" "$lib"
# Fix references to other bundled libraries
for otherlib in release/macos/libs/*.dylib; do
othername=$(basename "$otherlib")
ORIG_PATH=$(otool -L "$lib" | grep "$othername" | awk '{print $1}')
if [ ! -z "$ORIG_PATH" ] && [ "$ORIG_PATH" != "@rpath/$othername" ]; then
echo " Fixing $othername in $libname: $ORIG_PATH -> @rpath/$othername"
install_name_tool -change "$ORIG_PATH" "@rpath/$othername" "$lib"
fi
done
done
echo ""
echo "✓ Bundling complete"
echo ""
echo "📦 Binary info:"
file release/macos/vsdf
ls -lh release/macos/vsdf
echo ""
echo "📚 Bundled libraries:"
ls -lh release/macos/libs/
echo ""
echo "🔗 Binary dependencies after fixing:"
otool -L release/macos/vsdf
- name: Code sign binaries
run: |
echo "Ad-hoc signing binary and libraries..."
# Ad-hoc sign all libraries
for lib in release/macos/libs/*.dylib; do
echo "Signing $(basename "$lib")"
codesign --force --sign - "$lib"
done
# Ad-hoc sign the main binary
echo "Signing vsdf"
codesign --force --sign - release/macos/vsdf
echo "Verifying signatures..."
codesign -v release/macos/vsdf
for lib in release/macos/libs/*.dylib; do
codesign -v "$lib"
done
- name: Test binary execution
run: |
cd release/macos
./vsdf --version
echo "Binary execution test passed"
- name: Package binary
run: |
cp -r shaders release/macos/
cp README.md release/macos/
cp LICENSE release/macos/
cd release
tar -czf vsdf-macos-${{ matrix.arch }}.tar.gz macos/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vsdf-macos-${{ matrix.arch }}
path: release/vsdf-macos-${{ matrix.arch }}.tar.gz
build-windows:
name: Build Windows Release
# Temporarily disabled - see https://github.com/jamylak/vsdf/issues/33
if: false
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies via vcpkg
timeout-minutes: 25
run: |
Write-Host "Installing dependencies via vcpkg..."
vcpkg install vulkan:x64-windows glfw3:x64-windows glslang:x64-windows spdlog:x64-windows glm:x64-windows ffmpeg[avcodec,avformat,swscale]:x64-windows --recurse
vcpkg integrate install
Write-Host "Dependencies installed successfully"
- name: Configure CMake
run: |
cmake -B build `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
.
- name: Build
run: cmake --build build --config Release
- name: Package binary
run: |
New-Item -ItemType Directory -Force -Path release\windows
Copy-Item build\Release\vsdf.exe release\windows\
Copy-Item -Recurse shaders release\windows\
Copy-Item README.md release\windows\
Copy-Item LICENSE release\windows\
Compress-Archive -Path release\windows\* -DestinationPath release\vsdf-windows-x86_64.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vsdf-windows-x86_64
path: release/vsdf-windows-x86_64.zip
create-release:
name: Create GitHub Release
# Note: build-windows temporarily excluded from needs due to issue #33
needs: [build-linux, test-linux-ubuntu-24, test-linux-debian-13, build-macos]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/vsdf-linux-x86_64/vsdf-linux-x86_64.tar.gz
artifacts/vsdf-macos-x86_64/vsdf-macos-x86_64.tar.gz
artifacts/vsdf-macos-arm64/vsdf-macos-arm64.tar.gz
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}