Skip to content

test(quic): expand coverage for packet (#1040) #1499

test(quic): expand coverage for packet (#1040)

test(quic): expand coverage for packet (#1040) #1499

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop, phase-* ]
pull_request:
branches: [ main ]
jobs:
# Quick minimal build for fast feedback (Linux-only, no dependencies)
build-minimal:
name: Minimal Build (Fast Feedback)
runs-on: ubuntu-24.04
timeout-minutes: 15
if: github.ref != 'refs/heads/gh-pages'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Checkout common_system
uses: actions/checkout@v6
with:
repository: kcenon/common_system
path: common_system
- name: Install minimal dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build g++ libssl-dev
cd common_system
cmake -B build -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF
sudo cmake --install build --prefix /usr/local
cd ..
- name: Configure minimal build
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_WITH_COMMON_SYSTEM=ON \
-DBUILD_WITH_LOGGER_SYSTEM=OFF \
-DBUILD_WITH_THREAD_SYSTEM=OFF \
-DBUILD_WITH_CONTAINER_SYSTEM=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SAMPLES=OFF
- name: Build
run: cmake --build build --parallel
build:
name: ${{ matrix.os }} / ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
# Skip only if pushed to gh-pages branch
if: github.ref != 'refs/heads/gh-pages'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
compiler: gcc
triplet: x64-linux
- os: ubuntu-24.04
compiler: clang
triplet: x64-linux
- os: macos-15
compiler: clang
triplet: arm64-osx
- os: windows-2022
compiler: msvc
triplet: x64-windows
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up compiler (MSVC)
if: matrix.compiler == 'msvc'
uses: ilammy/msvc-dev-cmd@v1
- name: Install build tools (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build g++ clang curl zip unzip tar pkg-config
- name: Install build tools (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja pkg-config
- name: Set up compiler (GCC)
if: matrix.compiler == 'gcc'
run: |
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
- name: Set up compiler (Clang - Linux)
if: matrix.compiler == 'clang' && runner.os == 'Linux'
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Set up compiler (Clang - macOS)
if: matrix.compiler == 'clang' && runner.os == 'macOS'
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Check architecture (Linux)
if: runner.os == 'Linux'
run: |
if [ "$(uname -m)" = "aarch64" ]; then
echo "VCPKG_FORCE_SYSTEM_BINARIES=arm" >> $GITHUB_ENV
fi
- name: Setup vcpkg
uses: kcenon/common_system/.github/actions/setup-vcpkg@main
with:
extra-cache-key: 'network-system'
- name: Cache vcpkg installed
uses: actions/cache@v5
id: vcpkg-installed
with:
path: ${{ github.workspace }}/vcpkg_installed
key: ${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-
- name: Install dependencies with vcpkg (Unix)
if: runner.os != 'Windows' && steps.vcpkg-installed.outputs.cache-hit != 'true'
run: |
${{ env.VCPKG_ROOT }}/vcpkg install --x-manifest-root=. --x-install-root=${{ github.workspace }}/vcpkg_installed --triplet ${{ matrix.triplet }}
- name: Install dependencies with vcpkg (Windows)
if: runner.os == 'Windows' && steps.vcpkg-installed.outputs.cache-hit != 'true'
shell: pwsh
run: |
${{ env.VCPKG_ROOT }}\vcpkg install --x-manifest-root=. --x-install-root=${{ github.workspace }}\vcpkg_installed --triplet ${{ matrix.triplet }}
- name: Configure and build (vcpkg - Unix)
if: runner.os != 'Windows'
id: build_vcpkg_unix
continue-on-error: true
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE="${{ env.CMAKE_TOOLCHAIN_FILE }}" \
-DBUILD_WITH_COMMON_SYSTEM=ON \
-DBUILD_WITH_LOGGER_SYSTEM=ON \
-DBUILD_WITH_THREAD_SYSTEM=ON \
-DBUILD_WITH_CONTAINER_SYSTEM=ON \
-DBUILD_MESSAGING_BRIDGE=OFF \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF
cmake --build build --config Debug
- name: Configure and build (vcpkg - Windows)
if: runner.os == 'Windows'
id: build_vcpkg_windows
continue-on-error: true
shell: pwsh
run: |
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_TOOLCHAIN_FILE="${{ env.CMAKE_TOOLCHAIN_FILE }}" `
-DBUILD_WITH_COMMON_SYSTEM=ON `
-DBUILD_WITH_LOGGER_SYSTEM=ON `
-DBUILD_WITH_THREAD_SYSTEM=ON `
-DBUILD_WITH_CONTAINER_SYSTEM=ON `
-DBUILD_MESSAGING_BRIDGE=OFF `
-DBUILD_TESTS=ON `
-DBUILD_SAMPLES=OFF
cmake --build build --config Debug
- name: Configure and build (fallback - Unix)
if: runner.os != 'Windows' && steps.build_vcpkg_unix.outcome != 'success'
run: |
echo "vcpkg build failed. Falling back to system libraries..."
rm -rf build
sudo apt-get install -y libgtest-dev libgmock-dev libasio-dev libfmt-dev libssl-dev liblz4-dev zlib1g-dev 2>/dev/null || \
brew install googletest asio fmt openssl@3 lz4 zlib 2>/dev/null || true
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_WITH_COMMON_SYSTEM=ON \
-DBUILD_WITH_LOGGER_SYSTEM=ON \
-DBUILD_WITH_THREAD_SYSTEM=ON \
-DBUILD_WITH_CONTAINER_SYSTEM=ON \
-DBUILD_MESSAGING_BRIDGE=OFF \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF
cmake --build build --config Debug
- name: Configure and build (fallback - Windows)
if: runner.os == 'Windows' && steps.build_vcpkg_windows.outcome != 'success'
shell: pwsh
run: |
Write-Host "vcpkg build failed. Falling back to system vcpkg..."
if (Test-Path build) { Remove-Item -Recurse -Force build }
$toolchainFile = "$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake"
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_TOOLCHAIN_FILE="$toolchainFile" `
-DBUILD_WITH_COMMON_SYSTEM=ON `
-DBUILD_WITH_LOGGER_SYSTEM=ON `
-DBUILD_WITH_THREAD_SYSTEM=ON `
-DBUILD_WITH_CONTAINER_SYSTEM=ON `
-DBUILD_MESSAGING_BRIDGE=OFF `
-DBUILD_TESTS=ON `
-DBUILD_SAMPLES=OFF
cmake --build build --config Debug
- name: Test (Unix)
if: runner.os != 'Windows'
run: |
cd build
ctest -C Debug --output-on-failure --verbose || true
- name: Upload build artifacts
if: failure()
uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: build-${{ matrix.os }}-${{ matrix.compiler }}-logs
path: |
build/CMakeFiles/*.log
build/Testing/Temporary/
# Phase 0: Sanitizer checks (informational, non-blocking)
# Uses ASIO 1.32.0 from source (matching sanitizers.yml) because Ubuntu 24.04's
# libasio-dev (1.28.1) has a recycling allocator bug that causes SEGV under sanitizers.
sanitizers:
name: Sanitizers (${{ matrix.sanitizer.name }})
runs-on: ubuntu-24.04
timeout-minutes: 60
continue-on-error: true
strategy:
fail-fast: false
matrix:
sanitizer:
- name: ThreadSanitizer
option: ENABLE_TSAN
env_var: TSAN_OPTIONS
env_value: "second_deadlock_stack=1"
cxx_flags: "-fsanitize=thread -g"
- name: AddressSanitizer
option: ENABLE_ASAN
env_var: ASAN_OPTIONS
env_value: "detect_leaks=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
cxx_flags: "-fsanitize=address -fno-omit-frame-pointer -g"
- name: UndefinedBehaviorSanitizer
option: ENABLE_UBSAN
env_var: UBSAN_OPTIONS
env_value: "print_stacktrace=1:halt_on_error=0"
cxx_flags: "-fsanitize=undefined -fno-omit-frame-pointer -g"
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Checkout common_system
uses: actions/checkout@v6
with:
repository: kcenon/common_system
path: common_system
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout thread_system
uses: actions/checkout@v6
with:
repository: kcenon/thread_system
path: thread_system
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout logger_system
uses: actions/checkout@v6
with:
repository: kcenon/logger_system
path: logger_system
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout container_system
uses: actions/checkout@v6
with:
repository: kcenon/container_system
path: container_system
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
sudo apt-get update
# Note: Do NOT install libasio-dev here. Ubuntu 24.04 ships ASIO 1.28.1
# which has a bug where the recycling allocator returns null under sanitizers.
sudo apt-get install -y cmake ninja-build clang libgtest-dev libgmock-dev libfmt-dev libssl-dev liblz4-dev zlib1g-dev
- name: Install ASIO from source
run: |
# Ubuntu 24.04's libasio-dev (1.28.1) has a bug where the recycling allocator
# can return null when running under sanitizers, causing SEGV. ASIO 1.32.0
# has fixes for the recycling allocator.
curl -L https://github.com/chriskohlhoff/asio/archive/asio-1-32-0.tar.gz -o asio.tar.gz
tar xzf asio.tar.gz
sudo mkdir -p /usr/local/include
sudo cp -r asio-asio-1-32-0/asio/include/asio /usr/local/include/
sudo cp asio-asio-1-32-0/asio/include/asio.hpp /usr/local/include/
- name: Build ecosystem dependencies
shell: bash
run: |
# All ecosystem deps must be built with the same sanitizer flags as
# network_system. Mixing instrumented and non-instrumented code causes
# heap corruption (glibc malloc assertion failures).
SANITIZER_CXX_FLAGS="${{ matrix.sanitizer.cxx_flags }}"
# Build common_system (Tier 0 - must be first)
if [ -d "common_system" ]; then
echo "Building common_system..."
cd common_system
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_C_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SAMPLES=OFF
cmake --build build
cmake --install build --prefix ${{ github.workspace }}/deps/install
cd ..
fi
# Build thread_system
if [ -d "thread_system" ]; then
echo "Building thread_system..."
cd thread_system
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_C_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/install \
-DCOMMON_SYSTEM_INCLUDE_DIR=${{ github.workspace }}/deps/install/include \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SAMPLES=OFF \
-DBUILD_INTEGRATION_TESTS=OFF
cmake --build build --target thread_system
cmake --install build --prefix ${{ github.workspace }}/deps/install
cd ..
fi
# Build logger_system
if [ -d "logger_system" ]; then
echo "Building logger_system..."
cd logger_system
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_C_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/install \
-DCOMMON_SYSTEM_INCLUDE_DIR=${{ github.workspace }}/deps/install/include \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SAMPLES=OFF \
-DLOGGER_BUILD_INTEGRATION_TESTS=OFF
cmake --build build
cmake --install build --prefix ${{ github.workspace }}/deps/install
cd ..
fi
# Build container_system
if [ -d "container_system" ]; then
echo "Building container_system..."
cd container_system
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_C_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$SANITIZER_CXX_FLAGS" \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/install \
-DCOMMON_SYSTEM_INCLUDE_DIR=${{ github.workspace }}/deps/install/include \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SAMPLES=OFF
cmake --build build
# Install may fail due to missing files in container_system CMake config
cmake --install build --prefix ${{ github.workspace }}/deps/install || true
cd ..
fi
- name: Configure CMake with ${{ matrix.sanitizer.name }}
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/install \
-D${{ matrix.sanitizer.option }}=ON \
-DBUILD_WITH_COMMON_SYSTEM=ON \
-DBUILD_WITH_LOGGER_SYSTEM=ON \
-DBUILD_WITH_THREAD_SYSTEM=ON \
-DBUILD_WITH_CONTAINER_SYSTEM=ON \
-DBUILD_MESSAGING_BRIDGE=OFF \
-DBUILD_TESTS=ON \
-DBUILD_SAMPLES=OFF \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DASIO_INCLUDE_DIR=/usr/local/include \
-DSKIP_ASIO_RECYCLING_WORKAROUND=ON
- name: Build with ${{ matrix.sanitizer.name }}
run: cmake --build build --config Debug
- name: Run tests with ${{ matrix.sanitizer.name }}
run: |
cd build
# Apply suppression files for sanitizers that support them
if [ "${{ matrix.sanitizer.option }}" = "ENABLE_UBSAN" ]; then
SUPP_FILE="${{ github.workspace }}/cmake/ubsan.supp"
if [ -f "$SUPP_FILE" ]; then
export UBSAN_OPTIONS="${{ matrix.sanitizer.env_value }}:suppressions=$SUPP_FILE"
fi
elif [ "${{ matrix.sanitizer.option }}" = "ENABLE_ASAN" ]; then
SUPP_FILE="${{ github.workspace }}/sanitizers/lsan_suppressions.txt"
if [ -f "$SUPP_FILE" ]; then
export LSAN_OPTIONS="suppressions=$SUPP_FILE"
fi
elif [ "${{ matrix.sanitizer.option }}" = "ENABLE_TSAN" ]; then
SUPP_FILE="${{ github.workspace }}/tsan_suppressions.txt"
if [ -f "$SUPP_FILE" ]; then
export TSAN_OPTIONS="${{ matrix.sanitizer.env_value }}:suppressions=$SUPP_FILE"
fi
fi
ctest -C Debug --output-on-failure --verbose -LE no_sanitizer
env:
${{ matrix.sanitizer.env_var }}: ${{ matrix.sanitizer.env_value }}
- name: Upload sanitizer logs
if: always()
uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: sanitizer-${{ matrix.sanitizer.name }}-logs
path: |
build/Testing/
build/**/*.log
retention-days: 7
# Downstream compatibility test (informational, non-blocking)
test-downstream:
name: Test Downstream Compatibility
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 30
continue-on-error: true
steps:
- name: Checkout network_system
uses: actions/checkout@v6
with:
path: network_system
- name: Checkout database_system
uses: actions/checkout@v6
with:
repository: kcenon/database_system
path: database_system
continue-on-error: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build g++ libssl-dev libfmt-dev libasio-dev
- name: Build network_system
working-directory: network_system
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_WITH_COMMON_SYSTEM=ON \
-DBUILD_WITH_LOGGER_SYSTEM=ON \
-DBUILD_WITH_THREAD_SYSTEM=ON \
-DBUILD_WITH_CONTAINER_SYSTEM=ON \
-DBUILD_SAMPLES=OFF
cmake --build build --config Release --parallel
cmake --install build --prefix ${{ github.workspace }}/install
- name: Test database_system can use network_system
if: success()
working-directory: database_system
continue-on-error: true
run: |
cmake -B build -G Ninja \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install \
-DUSE_NETWORK_SYSTEM=ON
cmake --build build --parallel