@@ -305,3 +305,141 @@ jobs:
305305 build/Testing/
306306 build/**/*.log
307307 retention-days : 7
308+
309+ # LGPL-2.1 compliance: verify libmariadb is dynamically linked
310+ mysql-linkage-check :
311+ name : MySQL Linkage / ${{ matrix.os }}
312+ runs-on : ${{ matrix.os }}
313+ timeout-minutes : 30
314+
315+ strategy :
316+ fail-fast : false
317+ matrix :
318+ include :
319+ - os : ubuntu-24.04
320+ check-cmd : ldd
321+ - os : macos-14
322+ check-cmd : otool -L
323+
324+ steps :
325+ - name : Checkout database_system
326+ uses : actions/checkout@v4
327+ with :
328+ submodules : recursive
329+
330+ - name : Checkout common_system
331+ uses : actions/checkout@v4
332+ with :
333+ repository : kcenon/common_system
334+ path : common_system
335+ token : ${{ secrets.GITHUB_TOKEN }}
336+
337+ - name : Install dependencies (Ubuntu)
338+ if : runner.os == 'Linux'
339+ run : |
340+ sudo apt-get update
341+ sudo apt-get install -y cmake ninja-build g++-13 libgtest-dev libgmock-dev \
342+ libmariadb-dev pkg-config
343+
344+ - name : Install dependencies (macOS)
345+ if : runner.os == 'macOS'
346+ run : |
347+ brew install ninja googletest mariadb-connector-c
348+
349+ - name : Build and install common_system
350+ run : |
351+ cd common_system
352+ cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DUSE_UNIT_TEST=OFF
353+ cmake --build build --config Release
354+ sudo cmake --install build --prefix /usr/local
355+
356+ - name : Set up compiler (Ubuntu)
357+ if : runner.os == 'Linux'
358+ run : |
359+ echo "CC=gcc-13" >> $GITHUB_ENV
360+ echo "CXX=g++-13" >> $GITHUB_ENV
361+
362+ - name : Configure CMake with MySQL
363+ run : |
364+ cmake -B build -G Ninja \
365+ -DCMAKE_BUILD_TYPE=Debug \
366+ -DALLOW_BUILD_WITHOUT_NETWORK_SYSTEM=ON \
367+ -DUSE_THREAD_SYSTEM=OFF \
368+ -DUSE_MONITORING_SYSTEM=OFF \
369+ -DUSE_CONTAINER_SYSTEM=OFF \
370+ -DUSE_UNIT_TEST=ON \
371+ -DBUILD_DATABASE_SAMPLES=OFF \
372+ -DDATABASE_BUILD_INTEGRATION_TESTS=OFF \
373+ -DUSE_POSTGRESQL=OFF \
374+ -DUSE_MYSQL=ON
375+
376+ - name : Build
377+ run : cmake --build build --config Debug --parallel
378+
379+ - name : Verify libmariadb dynamic linkage
380+ run : |
381+ echo "=== LGPL-2.1 Dynamic Linking Verification ==="
382+ echo ""
383+
384+ FOUND_BINARY=false
385+ LINKAGE_OK=true
386+
387+ # Check all built executables and shared libraries
388+ for binary in $(find build/bin build/lib -type f \( -perm +111 -o -name "*.so" -o -name "*.dylib" \) 2>/dev/null); do
389+ # Skip if not an ELF/Mach-O binary
390+ file "$binary" | grep -qE "(ELF|Mach-O)" || continue
391+
392+ echo "Checking: $binary"
393+ DEPS=$(${{ matrix.check-cmd }} "$binary" 2>/dev/null || true)
394+ echo "$DEPS"
395+
396+ if echo "$DEPS" | grep -qi "mariadb\|mysql"; then
397+ FOUND_BINARY=true
398+ echo " -> libmariadb dependency detected"
399+
400+ # Verify it is a shared library reference (not static)
401+ if echo "$DEPS" | grep -qiE "libmariadb.*\.so|libmariadb.*\.dylib|libmysqlclient.*\.so|libmysqlclient.*\.dylib"; then
402+ echo " -> PASS: dynamically linked (LGPL-2.1 compliant)"
403+ else
404+ echo " -> FAIL: linkage type unclear, manual review needed"
405+ LINKAGE_OK=false
406+ fi
407+ fi
408+ echo ""
409+ done
410+
411+ # Also check the static library for embedded static references
412+ for archive in $(find build/lib -name "*.a" 2>/dev/null); do
413+ echo "Checking static archive: $archive"
414+ SYMBOLS=$(nm "$archive" 2>/dev/null | grep -i "mysql_real_connect\|mysql_init" | head -5 || true)
415+ if [ -n "$SYMBOLS" ]; then
416+ echo " MySQL symbols found in archive (expected — resolved at link time via shared lib)"
417+ echo "$SYMBOLS"
418+ FOUND_BINARY=true
419+ fi
420+ echo ""
421+ done
422+
423+ echo "=== Summary ==="
424+ if [ "$FOUND_BINARY" = false ]; then
425+ echo "WARNING: No binaries with libmariadb dependency found."
426+ echo "This may indicate MySQL backend was not compiled into any binary."
427+ echo "Check that USE_MYSQL=ON is effective and test binaries link the database library."
428+ exit 0
429+ fi
430+
431+ if [ "$LINKAGE_OK" = true ]; then
432+ echo "PASS: libmariadb is dynamically linked (LGPL-2.1 compliant)"
433+ else
434+ echo "FAIL: libmariadb linkage verification failed"
435+ exit 1
436+ fi
437+
438+ - name : Run MySQL backend tests
439+ timeout-minutes : 5
440+ run : |
441+ cd build
442+ # Run tests filtering for mysql-related tests
443+ ctest -C Debug --output-on-failure --timeout 30 -R "mysql|MySQL|mariadb|MariaDB" || true
444+ # Also run general database tests
445+ ctest -C Debug --output-on-failure --timeout 30 || true
0 commit comments