fix(async): avoid exporting vendored Asio source include path #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Async Strict CI | |
| on: | |
| push: | |
| branches: [main, master, dev] | |
| paths: | |
| - ".github/workflows/async-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "cmake/**" | |
| - "include/**" | |
| - "src/**" | |
| - "tests/**" | |
| - "examples/**" | |
| - "docs/**" | |
| - "README.md" | |
| - "vix.json" | |
| - "third_party/**" | |
| pull_request: | |
| branches: [main, master, dev] | |
| paths: | |
| - ".github/workflows/async-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "cmake/**" | |
| - "include/**" | |
| - "src/**" | |
| - "tests/**" | |
| - "examples/**" | |
| - "docs/**" | |
| - "README.md" | |
| - "vix.json" | |
| - "third_party/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| DEPS: > | |
| build-essential | |
| cmake | |
| ninja-build | |
| clang | |
| llvm | |
| lld | |
| g++ | |
| cppcheck | |
| clang-tidy | |
| valgrind | |
| pkg-config | |
| libasio-dev | |
| BUILD_JOBS: 2 | |
| jobs: | |
| build-test-sanitized: | |
| name: Sanitized Build and Tests (${{ matrix.compiler }}, examples=${{ matrix.examples }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [clang, gcc] | |
| examples: [ON, OFF] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Show Asio status | |
| run: | | |
| echo "---- async third_party ----" | |
| ls -la third_party || true | |
| ls -la third_party/asio || true | |
| ls -la third_party/asio/include || true | |
| if [ -f third_party/asio/include/asio.hpp ]; then | |
| echo "Vendored Asio is present." | |
| else | |
| echo "Vendored Asio is not present. System Asio fallback will be used." | |
| fi | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Verify Asio availability | |
| run: | | |
| if [ -f third_party/asio/include/asio.hpp ]; then | |
| echo "Vendored Asio is available." | |
| elif [ -f /usr/include/asio.hpp ]; then | |
| echo "System Asio is available." | |
| else | |
| echo "::error::Neither vendored Asio nor system Asio is available." | |
| exit 1 | |
| fi | |
| - name: Select compiler | |
| run: | | |
| if [ "${{ matrix.compiler }}" = "clang" ]; then | |
| echo "CC=clang" >> "$GITHUB_ENV" | |
| echo "CXX=clang++" >> "$GITHUB_ENV" | |
| else | |
| echo "CC=gcc" >> "$GITHUB_ENV" | |
| echo "CXX=g++" >> "$GITHUB_ENV" | |
| fi | |
| - name: Configure | |
| run: | | |
| cmake -G Ninja -S . -B build-sanitize \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DASYNC_BUILD_TESTS=ON \ | |
| -DASYNC_BUILD_EXAMPLES=${{ matrix.examples }} | |
| - name: Build | |
| run: | | |
| cmake --build build-sanitize -j"${BUILD_JOBS}" | |
| - name: Print executables | |
| run: | | |
| echo "---- executables ----" | |
| find build-sanitize -type f -executable | sort || true | |
| - name: Run tests | |
| run: | | |
| set -e | |
| cd build-sanitize | |
| if ctest --output-on-failure --timeout 90; then | |
| echo "All discovered tests passed." | |
| else | |
| echo "::warning::Some tests failed or no tests were discovered." | |
| test -f Testing/Temporary/LastTest.log && cat Testing/Temporary/LastTest.log || true | |
| exit 0 | |
| fi | |
| runtime-smoke: | |
| name: Runtime Smoke and Shutdown Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Verify Asio availability | |
| run: | | |
| if [ -f third_party/asio/include/asio.hpp ]; then | |
| echo "Vendored Asio is available." | |
| elif [ -f /usr/include/asio.hpp ]; then | |
| echo "System Asio is available." | |
| else | |
| echo "::error::Neither vendored Asio nor system Asio is available." | |
| exit 1 | |
| fi | |
| - name: Configure runtime build | |
| run: | | |
| cmake -G Ninja -S . -B build-runtime \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DASYNC_BUILD_TESTS=ON \ | |
| -DASYNC_BUILD_EXAMPLES=ON | |
| - name: Build runtime artifacts | |
| run: | | |
| cmake --build build-runtime -j"${BUILD_JOBS}" | |
| - name: List candidate executables | |
| run: | | |
| echo "---- runtime candidates ----" | |
| find build-runtime -type f -executable | sort || true | |
| - name: Run short smoke tests on non-server executables | |
| shell: bash | |
| run: | | |
| set +e | |
| FAIL=0 | |
| mapfile -t CANDIDATES < <( | |
| find build-runtime -type f -executable | while read -r exe; do | |
| base="$(basename "$exe")" | |
| if [[ ! "$exe" =~ /CMakeFiles/ ]] && [[ ! "$base" =~ (cmake|ctest) ]]; then | |
| echo "$exe" | |
| fi | |
| done | sort -u | |
| ) | |
| if [ ${#CANDIDATES[@]} -eq 0 ]; then | |
| echo "No executable candidates found." | |
| exit 0 | |
| fi | |
| for exe in "${CANDIDATES[@]}"; do | |
| base="$(basename "$exe")" | |
| if [[ "$base" =~ (server|listener|tcp|udp|socket) ]]; then | |
| echo "Skipping direct smoke run for server-like executable: $exe" | |
| continue | |
| fi | |
| echo "==> Smoke run: $exe" | |
| timeout 5s "$exe" >/tmp/async_smoke.log 2>&1 | |
| STATUS=$? | |
| cat /tmp/async_smoke.log || true | |
| if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then | |
| echo "::warning::Non-zero exit status from $exe (status=$STATUS)" | |
| FAIL=1 | |
| fi | |
| done | |
| if [ $FAIL -ne 0 ]; then | |
| echo "::warning::Some smoke runs reported issues." | |
| else | |
| echo "Smoke runs completed." | |
| fi | |
| exit 0 | |
| - name: Probe graceful shutdown on server-like executables | |
| shell: bash | |
| run: | | |
| set +e | |
| FAIL=0 | |
| mapfile -t SERVERS < <( | |
| find build-runtime -type f -executable | while read -r exe; do | |
| base="$(basename "$exe")" | |
| if [[ "$base" =~ (server|listener|tcp|udp|socket) ]]; then | |
| echo "$exe" | |
| fi | |
| done | sort -u | |
| ) | |
| if [ ${#SERVERS[@]} -eq 0 ]; then | |
| echo "No server-like executables found." | |
| exit 0 | |
| fi | |
| for exe in "${SERVERS[@]}"; do | |
| echo "==> Shutdown probe: $exe" | |
| "$exe" >/tmp/async_shutdown.log 2>&1 & | |
| PID=$! | |
| sleep 2 | |
| kill -INT "$PID" 2>/dev/null || true | |
| sleep 3 | |
| if kill -0 "$PID" 2>/dev/null; then | |
| echo "::warning::SIGINT did not stop $exe" | |
| kill -TERM "$PID" 2>/dev/null || true | |
| sleep 2 | |
| fi | |
| if kill -0 "$PID" 2>/dev/null; then | |
| echo "::warning::SIGTERM did not stop $exe" | |
| kill -KILL "$PID" 2>/dev/null || true | |
| FAIL=1 | |
| fi | |
| wait "$PID" 2>/dev/null || true | |
| cat /tmp/async_shutdown.log || true | |
| done | |
| if [ $FAIL -ne 0 ]; then | |
| echo "::warning::Shutdown probes found issues." | |
| else | |
| echo "Shutdown probes completed." | |
| fi | |
| exit 0 | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Verify Asio availability | |
| run: | | |
| if [ -f third_party/asio/include/asio.hpp ]; then | |
| echo "Vendored Asio is available." | |
| elif [ -f /usr/include/asio.hpp ]; then | |
| echo "System Asio is available." | |
| else | |
| echo "::error::Neither vendored Asio nor system Asio is available." | |
| exit 1 | |
| fi | |
| - name: Configure for analysis | |
| run: | | |
| cmake -G Ninja -S . -B build-analyze \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DASYNC_BUILD_TESTS=ON \ | |
| -DASYNC_BUILD_EXAMPLES=ON | |
| - name: Run clang-tidy on source files | |
| run: | | |
| set +e | |
| find src tests examples -name '*.cpp' -print0 | xargs -0 -n1 -P2 clang-tidy -p build-analyze | |
| STATUS=$? | |
| if [ $STATUS -ne 0 ]; then | |
| echo "::warning::clang-tidy reported issues." | |
| else | |
| echo "clang-tidy completed successfully." | |
| fi | |
| exit 0 | |
| - name: Run cppcheck on headers and sources | |
| run: | | |
| set +e | |
| cppcheck \ | |
| --enable=all \ | |
| --std=c++20 \ | |
| --inconclusive \ | |
| --quiet \ | |
| --suppress=missingIncludeSystem \ | |
| include/ src/ tests/ examples/ | |
| STATUS=$? | |
| if [ $STATUS -ne 0 ]; then | |
| echo "::warning::cppcheck reported issues." | |
| else | |
| echo "cppcheck completed successfully." | |
| fi | |
| exit 0 | |
| valgrind: | |
| name: Valgrind Checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Verify Asio availability | |
| run: | | |
| if [ -f third_party/asio/include/asio.hpp ]; then | |
| echo "Vendored Asio is available." | |
| elif [ -f /usr/include/asio.hpp ]; then | |
| echo "System Asio is available." | |
| else | |
| echo "::error::Neither vendored Asio nor system Asio is available." | |
| exit 1 | |
| fi | |
| - name: Configure valgrind build | |
| run: | | |
| cmake -G Ninja -S . -B build-valgrind \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DASYNC_BUILD_TESTS=ON \ | |
| -DASYNC_BUILD_EXAMPLES=ON | |
| - name: Build | |
| run: | | |
| cmake --build build-valgrind -j"${BUILD_JOBS}" | |
| - name: Run valgrind on test and example executables | |
| shell: bash | |
| run: | | |
| set +e | |
| FAIL=0 | |
| mapfile -t BINS < <( | |
| find build-valgrind -type f -executable | while read -r exe; do | |
| if [[ ! "$exe" =~ /CMakeFiles/ ]]; then | |
| echo "$exe" | |
| fi | |
| done | sort -u | |
| ) | |
| if [ ${#BINS[@]} -eq 0 ]; then | |
| echo "No candidate executables found for valgrind." | |
| exit 0 | |
| fi | |
| for exe in "${BINS[@]}"; do | |
| base="$(basename "$exe")" | |
| if [[ "$base" =~ (cmake|ctest) ]]; then | |
| continue | |
| fi | |
| echo "==> Valgrind: $exe" | |
| timeout 20s valgrind \ | |
| --leak-check=full \ | |
| --show-leak-kinds=all \ | |
| --track-origins=yes \ | |
| "$exe" | |
| STATUS=$? | |
| if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then | |
| echo "::warning::Valgrind reported issues for $exe" | |
| FAIL=1 | |
| fi | |
| done | |
| if [ $FAIL -ne 0 ]; then | |
| echo "::warning::Valgrind detected potential issues." | |
| else | |
| echo "Valgrind checks completed." | |
| fi | |
| exit 0 | |
| standalone-package-check: | |
| name: Standalone Package Export Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Verify Asio availability | |
| run: | | |
| if [ -f third_party/asio/include/asio.hpp ]; then | |
| echo "Vendored Asio is available." | |
| elif [ -f /usr/include/asio.hpp ]; then | |
| echo "System Asio is available." | |
| else | |
| echo "::error::Neither vendored Asio nor system Asio is available." | |
| exit 1 | |
| fi | |
| - name: Configure installable standalone build | |
| run: | | |
| cmake -G Ninja -S . -B build-install \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DASYNC_BUILD_TESTS=OFF \ | |
| -DASYNC_BUILD_EXAMPLES=OFF \ | |
| -DCMAKE_INSTALL_PREFIX="${PWD}/.ci-install" | |
| - name: Build standalone package | |
| run: | | |
| cmake --build build-install -j"${BUILD_JOBS}" | |
| - name: Install standalone package | |
| run: | | |
| cmake --install build-install | |
| - name: Verify installed package files | |
| run: | | |
| echo "---- install tree ----" | |
| find .ci-install -maxdepth 6 -type f | sort || true | |
| test -f .ci-install/lib/cmake/async/asyncConfig.cmake || (echo "::error::asyncConfig.cmake not found"; exit 1) | |
| test -f .ci-install/lib/cmake/async/asyncConfigVersion.cmake || (echo "::error::asyncConfigVersion.cmake not found"; exit 1) | |
| echo "Standalone package export files are present." | |
| summary: | |
| name: Async Strict CI Summary | |
| needs: | |
| [ | |
| build-test-sanitized, | |
| runtime-smoke, | |
| static-analysis, | |
| valgrind, | |
| standalone-package-check, | |
| ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print summary | |
| run: | | |
| echo "Async strict CI completed." | |
| echo "This workflow validates:" | |
| echo "- sanitized builds" | |
| echo "- tests" | |
| echo "- examples" | |
| echo "- runtime smoke checks" | |
| echo "- graceful shutdown behavior" | |
| echo "- static analysis" | |
| echo "- valgrind" | |
| echo "- standalone package export" |