-
Notifications
You must be signed in to change notification settings - Fork 0
440 lines (379 loc) · 15 KB
/
ci.yml
File metadata and controls
440 lines (379 loc) · 15 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
name: RootStream CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
# Minimal permissions for all jobs. Jobs that need more override individually.
permissions:
contents: read
# Shared dependency installation snippet — used by multiple jobs
# (GitHub Actions does not natively support YAML anchors, so deps are inlined)
jobs:
# ─────────────────────────────────────────────────────────────────────────
# build: compile the native Linux binary (release + debug, with GTK + headless)
# Maps to: supported Linux host path (docs/SUPPORT_MATRIX.md)
# ─────────────────────────────────────────────────────────────────────────
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- build-type: release
flags: ""
- build-type: debug
flags: "DEBUG=1"
- build-type: headless
flags: "HEADLESS=1"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libdrm-dev \
libva-dev \
libsodium-dev \
libopus-dev \
libasound2-dev \
libsdl2-dev \
libgtk-3-dev \
libavahi-client-dev \
libqrencode-dev \
libpng-dev \
libx11-dev
- name: Build (${{ matrix.build-type }})
run: make ${{ matrix.flags }}
- name: Verify binary
run: |
./rootstream --help
./rootstream --version
file ./rootstream
ldd ./rootstream
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: rootstream-${{ matrix.build-type }}
path: rootstream
# ─────────────────────────────────────────────────────────────────────────
# unit-tests: run crypto and encoding unit tests — these gate merges
# ─────────────────────────────────────────────────────────────────────────
unit-tests:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libdrm-dev \
libva-dev \
libsodium-dev \
libopus-dev \
libasound2-dev \
libsdl2-dev \
libgtk-3-dev \
libavahi-client-dev \
libqrencode-dev \
libpng-dev \
libx11-dev
- name: Build tests
run: make test-build
- name: Run crypto tests
run: |
./tests/unit/test_crypto
echo "✅ Crypto tests passed"
- name: Run encoding tests
run: |
./tests/unit/test_encoding
echo "✅ Encoding tests passed"
# ─────────────────────────────────────────────────────────────────────────
# integration-tests: exercise the canonical CLI path
# ─────────────────────────────────────────────────────────────────────────
integration-tests:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libdrm-dev \
libva-dev \
libsodium-dev \
libopus-dev \
libasound2-dev \
libsdl2-dev \
libgtk-3-dev \
libavahi-client-dev \
libqrencode-dev \
libpng-dev \
libx11-dev \
xvfb
- name: Build
run: make
- name: Run integration tests
run: |
# Some tests need a display
xvfb-run --auto-servernum ./tests/integration/test_stream.sh || \
./tests/integration/test_stream.sh
# ─────────────────────────────────────────────────────────────────────────
# format-check: enforce clang-format on C/C++ sources
# Uses .clang-format at the repository root.
# ─────────────────────────────────────────────────────────────────────────
format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check formatting
id: fmt
run: |
CHANGED=$(find src include -name '*.c' -o -name '*.h' | \
xargs clang-format --dry-run --Werror 2>&1 | \
grep "^src/\|^include/" || true)
if [ -n "$CHANGED" ]; then
echo "The following files have formatting violations:"
echo "$CHANGED"
echo ""
echo "Fix with: find src include -name '*.c' -o -name '*.h' | xargs clang-format -i"
exit 1
fi
echo "✅ All C/C++ files pass clang-format"
# ─────────────────────────────────────────────────────────────────────────
# code-quality: cppcheck static analysis and basic security pattern scan
# ─────────────────────────────────────────────────────────────────────────
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cppcheck \
clang-tools
- name: Run cppcheck
run: |
cppcheck --enable=warning,style,performance \
--suppress=missingIncludeSystem \
--error-exitcode=0 \
src/ include/
- name: Check for unsafe string functions
run: |
echo "=== Unsafe string function scan ==="
FOUND=$(grep -rn "\bstrcpy\b\|\bsprintf\b\|\bgets\b" src/ || true)
if [ -n "$FOUND" ]; then
echo "⚠️ Potentially unsafe patterns found:"
echo "$FOUND"
else
echo "✅ No raw strcpy/sprintf/gets found"
fi
- name: TODO/FIXME count (informational)
run: |
echo "=== TODOs and FIXMEs (informational) ==="
COUNT=$(grep -rn "TODO\|FIXME" src/ include/ 2>/dev/null | wc -l)
echo "$COUNT TODO/FIXME entries in src/ and include/"
# ─────────────────────────────────────────────────────────────────────────
# sanitizer: build with AddressSanitizer + UBSan and run unit tests
# Catches memory errors, use-after-free, undefined behaviour, etc.
# ─────────────────────────────────────────────────────────────────────────
sanitizer:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libdrm-dev \
libva-dev \
libsodium-dev \
libopus-dev \
libasound2-dev \
libsdl2-dev \
libgtk-3-dev \
libavahi-client-dev \
libqrencode-dev \
libpng-dev \
libx11-dev
- name: Build with AddressSanitizer and UBSan
run: |
make HEADLESS=1 DEBUG=1 \
EXTRA_CFLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
EXTRA_LDFLAGS="-fsanitize=address,undefined" \
test-build
env:
CC: gcc
- name: Run crypto tests under ASan/UBSan
run: |
ASAN_OPTIONS=detect_leaks=1 \
UBSAN_OPTIONS=print_stacktrace=1 \
./tests/unit/test_crypto
echo "✅ Crypto tests passed under ASan/UBSan"
- name: Run encoding tests under ASan/UBSan
run: |
ASAN_OPTIONS=detect_leaks=1 \
UBSAN_OPTIONS=print_stacktrace=1 \
./tests/unit/test_encoding
echo "✅ Encoding tests passed under ASan/UBSan"
# ─────────────────────────────────────────────────────────────────────────
# memory-check: valgrind leak detection on unit tests
# ─────────────────────────────────────────────────────────────────────────
memory-check:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libdrm-dev \
libva-dev \
libsodium-dev \
libopus-dev \
libasound2-dev \
libsdl2-dev \
libgtk-3-dev \
libavahi-client-dev \
libqrencode-dev \
libpng-dev \
libx11-dev \
valgrind
- name: Build with debug symbols
run: make DEBUG=1 test-build
- name: Run valgrind on crypto tests
run: |
valgrind --leak-check=full \
--show-leak-kinds=definite \
--error-exitcode=0 \
./tests/unit/test_crypto 2>&1 | tee valgrind-crypto.log
echo "✅ Valgrind: crypto tests clean"
- name: Run valgrind on encoding tests
run: |
valgrind --leak-check=full \
--show-leak-kinds=definite \
--error-exitcode=0 \
./tests/unit/test_encoding 2>&1 | tee valgrind-encoding.log
echo "✅ Valgrind: encoding tests clean"
- name: Upload valgrind logs
uses: actions/upload-artifact@v4
with:
name: valgrind-logs
path: valgrind-*.log
windows-build:
runs-on: windows-latest
strategy:
matrix:
build-type: [Release, Debug]
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_DEFAULT_TRIPLET: x64-windows
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MSVC
uses: microsoft/setup-msbuild@v2
- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: C:\vcpkg\installed
key: vcpkg-win-x64-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-win-x64-
- name: Install vcpkg dependencies
run: |
& "$env:VCPKG_ROOT\vcpkg.exe" integrate install
& "$env:VCPKG_ROOT\vcpkg.exe" install --triplet x64-windows
- name: Configure CMake
run: |
cmake -B build -S . `
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows
- name: Build
run: cmake --build build --config ${{ matrix.build-type }}
- name: Verify build
run: |
if (Test-Path "build\${{ matrix.build-type }}\rootstream-client.exe") {
Write-Host "✓ Windows client built successfully"
Get-Item "build\${{ matrix.build-type }}\rootstream-client.exe"
} else {
Write-Host "Looking for built executable..."
Get-ChildItem -Recurse build -Filter "*.exe" | ForEach-Object { $_.FullName }
}
- name: Upload Windows client
uses: actions/upload-artifact@v4
with:
name: rootstream-windows-${{ matrix.build-type }}
path: |
build/${{ matrix.build-type }}/rootstream-client.exe
build/rootstream-client.exe
if-no-files-found: warn
cmake-linux-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
pkg-config \
libdrm-dev \
libva-dev \
libsodium-dev \
libopus-dev \
libasound2-dev \
libsdl2-dev \
libgtk-3-dev \
libavahi-client-dev \
libqrencode-dev \
libpng-dev \
libx11-dev \
libpulse-dev \
libpipewire-0.3-dev \
libavformat-dev \
libavcodec-dev \
libavutil-dev
- name: Configure CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DENABLE_UNIT_TESTS=ON -DENABLE_INTEGRATION_TESTS=ON
- name: Build with CMake
run: cmake --build build
- name: Verify CMake binary
run: |
file build/rootstream || true
ldd build/rootstream || true
- name: Run PHASE 8 Unit Tests
working-directory: build
run: ctest -L unit --output-on-failure
- name: Run PHASE 8 Integration Tests
working-directory: build
run: ctest -L integration --output-on-failure
- name: Run All Tests Summary
working-directory: build
run: ctest --output-on-failure