66 pull_request :
77 branches : [main]
88
9+ # Minimal permissions for all jobs. Jobs that need more override individually.
10+ permissions :
11+ contents : read
12+
13+ # Shared dependency installation snippet — used by multiple jobs
14+ # (GitHub Actions does not natively support YAML anchors, so deps are inlined)
15+
916jobs :
17+ # ─────────────────────────────────────────────────────────────────────────
18+ # build: compile the native Linux binary (release + debug, with GTK + headless)
19+ # Maps to: supported Linux host path (docs/SUPPORT_MATRIX.md)
20+ # ─────────────────────────────────────────────────────────────────────────
1021 build :
1122 runs-on : ubuntu-latest
1223 strategy :
1324 matrix :
14- build-type : [release, debug]
25+ include :
26+ - build-type : release
27+ flags : " "
28+ - build-type : debug
29+ flags : " DEBUG=1"
30+ - build-type : headless
31+ flags : " HEADLESS=1"
1532
1633 steps :
1734 - name : Checkout code
@@ -36,25 +53,24 @@ jobs:
3653 libx11-dev
3754
3855 - name : Build (${{ matrix.build-type }})
39- run : |
40- if [ "${{ matrix.build-type }}" = "debug" ]; then
41- make DEBUG=1
42- else
43- make
44- fi
56+ run : make ${{ matrix.flags }}
4557
4658 - name : Verify binary
4759 run : |
48- ./rootstream --help || true
60+ ./rootstream --help
61+ ./rootstream --version
4962 file ./rootstream
50- ldd ./rootstream || true
63+ ldd ./rootstream
5164
5265 - name : Upload binary
5366 uses : actions/upload-artifact@v4
5467 with :
5568 name : rootstream-${{ matrix.build-type }}
5669 path : rootstream
5770
71+ # ─────────────────────────────────────────────────────────────────────────
72+ # unit-tests: run crypto and encoding unit tests — these gate merges
73+ # ─────────────────────────────────────────────────────────────────────────
5874 unit-tests :
5975 runs-on : ubuntu-latest
6076 needs : build
@@ -85,11 +101,18 @@ jobs:
85101 run : make test-build
86102
87103 - name : Run crypto tests
88- run : ./tests/unit/test_crypto
104+ run : |
105+ ./tests/unit/test_crypto
106+ echo "✅ Crypto tests passed"
89107
90108 - name : Run encoding tests
91- run : ./tests/unit/test_encoding
109+ run : |
110+ ./tests/unit/test_encoding
111+ echo "✅ Encoding tests passed"
92112
113+ # ─────────────────────────────────────────────────────────────────────────
114+ # integration-tests: exercise the canonical CLI path
115+ # ─────────────────────────────────────────────────────────────────────────
93116 integration-tests :
94117 runs-on : ubuntu-latest
95118 needs : build
@@ -126,6 +149,40 @@ jobs:
126149 xvfb-run --auto-servernum ./tests/integration/test_stream.sh || \
127150 ./tests/integration/test_stream.sh
128151
152+ # ─────────────────────────────────────────────────────────────────────────
153+ # format-check: enforce clang-format on C/C++ sources
154+ # Uses .clang-format at the repository root.
155+ # ─────────────────────────────────────────────────────────────────────────
156+ format-check :
157+ runs-on : ubuntu-latest
158+
159+ steps :
160+ - name : Checkout code
161+ uses : actions/checkout@v4
162+
163+ - name : Install clang-format
164+ run : |
165+ sudo apt-get update
166+ sudo apt-get install -y clang-format
167+
168+ - name : Check formatting
169+ id : fmt
170+ run : |
171+ CHANGED=$(find src include -name '*.c' -o -name '*.h' | \
172+ xargs clang-format --dry-run --Werror 2>&1 | \
173+ grep "^src/\|^include/" || true)
174+ if [ -n "$CHANGED" ]; then
175+ echo "The following files have formatting violations:"
176+ echo "$CHANGED"
177+ echo ""
178+ echo "Fix with: find src include -name '*.c' -o -name '*.h' | xargs clang-format -i"
179+ exit 1
180+ fi
181+ echo "✅ All C/C++ files pass clang-format"
182+
183+ # ─────────────────────────────────────────────────────────────────────────
184+ # code-quality: cppcheck static analysis and basic security pattern scan
185+ # ─────────────────────────────────────────────────────────────────────────
129186 code-quality :
130187 runs-on : ubuntu-latest
131188
@@ -147,17 +204,78 @@ jobs:
147204 --error-exitcode=0 \
148205 src/ include/
149206
150- - name : Check for common issues
207+ - name : Check for unsafe string functions
208+ run : |
209+ echo "=== Unsafe string function scan ==="
210+ FOUND=$(grep -rn "\bstrcpy\b\|\bsprintf\b\|\bgets\b" src/ || true)
211+ if [ -n "$FOUND" ]; then
212+ echo "⚠️ Potentially unsafe patterns found:"
213+ echo "$FOUND"
214+ else
215+ echo "✅ No raw strcpy/sprintf/gets found"
216+ fi
217+
218+ - name : TODO/FIXME count (informational)
219+ run : |
220+ echo "=== TODOs and FIXMEs (informational) ==="
221+ COUNT=$(grep -rn "TODO\|FIXME" src/ include/ 2>/dev/null | wc -l)
222+ echo "$COUNT TODO/FIXME entries in src/ and include/"
223+
224+ # ─────────────────────────────────────────────────────────────────────────
225+ # sanitizer: build with AddressSanitizer + UBSan and run unit tests
226+ # Catches memory errors, use-after-free, undefined behaviour, etc.
227+ # ─────────────────────────────────────────────────────────────────────────
228+ sanitizer :
229+ runs-on : ubuntu-latest
230+
231+ steps :
232+ - name : Checkout code
233+ uses : actions/checkout@v4
234+
235+ - name : Install dependencies
151236 run : |
152- # Check for TODO/FIXME counts (informational)
153- echo "=== TODOs and FIXMEs ==="
154- grep -rn "TODO\|FIXME" src/ include/ || echo "None found"
237+ sudo apt-get update
238+ sudo apt-get install -y \
239+ build-essential \
240+ pkg-config \
241+ libdrm-dev \
242+ libva-dev \
243+ libsodium-dev \
244+ libopus-dev \
245+ libasound2-dev \
246+ libsdl2-dev \
247+ libgtk-3-dev \
248+ libavahi-client-dev \
249+ libqrencode-dev \
250+ libpng-dev \
251+ libx11-dev
155252
156- # Check for potential security issues
157- echo ""
158- echo "=== Potential security patterns ==="
159- grep -rn "strcpy\|sprintf\|gets" src/ || echo "None found (good!)"
253+ - name : Build with AddressSanitizer and UBSan
254+ run : |
255+ make HEADLESS=1 DEBUG=1 \
256+ EXTRA_CFLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
257+ EXTRA_LDFLAGS="-fsanitize=address,undefined" \
258+ test-build
259+ env :
260+ CC : gcc
261+
262+ - name : Run crypto tests under ASan/UBSan
263+ run : |
264+ ASAN_OPTIONS=detect_leaks=1 \
265+ UBSAN_OPTIONS=print_stacktrace=1 \
266+ ./tests/unit/test_crypto
267+ echo "✅ Crypto tests passed under ASan/UBSan"
160268
269+ - name : Run encoding tests under ASan/UBSan
270+ run : |
271+ ASAN_OPTIONS=detect_leaks=1 \
272+ UBSAN_OPTIONS=print_stacktrace=1 \
273+ ./tests/unit/test_encoding
274+ echo "✅ Encoding tests passed under ASan/UBSan"
275+
276+ # ─────────────────────────────────────────────────────────────────────────
277+ # memory-check: valgrind leak detection on unit tests
278+ # ─────────────────────────────────────────────────────────────────────────
161279 memory-check :
162280 runs-on : ubuntu-latest
163281 needs : build
@@ -188,17 +306,21 @@ jobs:
188306 - name : Build with debug symbols
189307 run : make DEBUG=1 test-build
190308
191- - name : Run valgrind on unit tests
309+ - name : Run valgrind on crypto tests
192310 run : |
193311 valgrind --leak-check=full \
194312 --show-leak-kinds=definite \
195313 --error-exitcode=0 \
196314 ./tests/unit/test_crypto 2>&1 | tee valgrind-crypto.log
315+ echo "✅ Valgrind: crypto tests clean"
197316
317+ - name : Run valgrind on encoding tests
318+ run : |
198319 valgrind --leak-check=full \
199320 --show-leak-kinds=definite \
200321 --error-exitcode=0 \
201322 ./tests/unit/test_encoding 2>&1 | tee valgrind-encoding.log
323+ echo "✅ Valgrind: encoding tests clean"
202324
203325 - name : Upload valgrind logs
204326 uses : actions/upload-artifact@v4
0 commit comments