build(core): add private precompiled headers #100
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: Core Strict CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/core-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "CMakePresets.json" | |
| - "include/**" | |
| - "src/**" | |
| - "tests/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "vix.json" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/core-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "CMakePresets.json" | |
| - "include/**" | |
| - "src/**" | |
| - "tests/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "vix.json" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| DEPS: > | |
| build-essential | |
| cmake | |
| ninja-build | |
| clang | |
| llvm | |
| lld | |
| g++ | |
| cppcheck | |
| clang-tidy | |
| valgrind | |
| pkg-config | |
| git | |
| curl | |
| ca-certificates | |
| libasio-dev | |
| nlohmann-json3-dev | |
| libspdlog-dev | |
| libfmt-dev | |
| libssl-dev | |
| BUILD_JOBS: 2 | |
| VIX_GIT_BRANCH: dev | |
| jobs: | |
| build-test-sanitized: | |
| name: Sanitized Build and Tests (${{ matrix.compiler }}, tls=${{ matrix.openssl }}, template=${{ matrix.template_mode }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: | |
| - clang | |
| - gcc | |
| openssl: | |
| - ON | |
| - OFF | |
| template_mode: | |
| - AUTO | |
| - OFF | |
| steps: | |
| - name: Checkout core repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends $DEPS | |
| test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1) | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../io \ | |
| ../json \ | |
| ../template | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Verify required sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt || (echo "::error::../error/CMakeLists.txt is missing"; exit 1) | |
| test -f ../path/CMakeLists.txt || (echo "::error::../path/CMakeLists.txt is missing"; exit 1) | |
| test -f ../env/CMakeLists.txt || (echo "::error::../env/CMakeLists.txt is missing"; exit 1) | |
| test -f ../utils/CMakeLists.txt || (echo "::error::../utils/CMakeLists.txt is missing"; exit 1) | |
| test -f ../async/CMakeLists.txt || (echo "::error::../async/CMakeLists.txt is missing"; exit 1) | |
| test -f ../io/CMakeLists.txt || (echo "::error::../io/CMakeLists.txt is missing"; exit 1) | |
| test -f ../json/CMakeLists.txt || (echo "::error::../json/CMakeLists.txt is missing"; exit 1) | |
| test -f ../json/include/vix/json/Simple.hpp || (echo "::error::../json/include/vix/json/Simple.hpp is missing"; exit 1) | |
| if [ -f ../async/third_party/asio/include/asio.hpp ]; then | |
| echo "Asio found in async." | |
| else | |
| echo "::error::Asio header missing." | |
| exit 1 | |
| fi | |
| - name: Export dependency include paths | |
| run: | | |
| EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../io/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include" | |
| fi | |
| echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV" | |
| echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV" | |
| - 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 -S . -B build-sanitize -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DVIX_CORE_BUILD_TESTS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=ON \ | |
| -DVIX_CORE_WITH_OPENSSL=${{ matrix.openssl }} \ | |
| -DVIX_CORE_WITH_TEMPLATE=${{ matrix.template_mode }} \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_BENCH_MODE=OFF | |
| - name: Build | |
| run: | | |
| cmake --build build-sanitize -j"${BUILD_JOBS}" | |
| - name: Run ctest | |
| run: | | |
| cd build-sanitize | |
| ctest --output-on-failure --timeout 90 | |
| runtime-smoke: | |
| name: Runtime Smoke and Shutdown Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout core repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends $DEPS | |
| test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1) | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../io \ | |
| ../json \ | |
| ../template | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Verify required sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt | |
| test -f ../path/CMakeLists.txt | |
| test -f ../env/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../async/CMakeLists.txt | |
| test -f ../io/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f ../json/include/vix/json/Simple.hpp | |
| - name: Export dependency include paths | |
| run: | | |
| EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../io/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include" | |
| fi | |
| echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV" | |
| echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV" | |
| - name: Configure runtime build | |
| run: | | |
| cmake -S . -B build-runtime -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DVIX_CORE_BUILD_TESTS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=OFF \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_BENCH_MODE=OFF | |
| - name: Build runtime artifacts | |
| run: | | |
| cmake --build build-runtime -j"${BUILD_JOBS}" | |
| - name: Run ctest | |
| run: | | |
| cd build-runtime | |
| ctest --output-on-failure --timeout 90 | |
| - 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|http|ws|listener|session) ]]; then | |
| echo "Skipping server-like executable: $exe" | |
| continue | |
| fi | |
| echo "==> Smoke run: $exe" | |
| timeout 5s "$exe" >/tmp/core_smoke.log 2>&1 | |
| STATUS=$? | |
| cat /tmp/core_smoke.log || true | |
| if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then | |
| echo "::warning::Non-zero exit status from $exe" | |
| FAIL=1 | |
| fi | |
| done | |
| exit 0 | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout core repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends $DEPS | |
| test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1) | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../io \ | |
| ../json \ | |
| ../template | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Verify required sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt | |
| test -f ../path/CMakeLists.txt | |
| test -f ../env/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../async/CMakeLists.txt | |
| test -f ../io/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f ../json/include/vix/json/Simple.hpp | |
| - name: Export dependency include paths | |
| run: | | |
| EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../io/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include" | |
| fi | |
| echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV" | |
| echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV" | |
| - name: Configure for analysis | |
| run: | | |
| cmake -S . -B build-analyze -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DVIX_CORE_BUILD_TESTS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_CORE_WITH_OPENSSL=ON \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_BENCH_MODE=OFF | |
| - name: Run clang-tidy on source files | |
| run: | | |
| set +e | |
| find src tests -name '*.cpp' -print0 | xargs -0 -r -n1 -P2 clang-tidy -p build-analyze | |
| 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/ | |
| exit 0 | |
| valgrind: | |
| name: Valgrind Checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout core repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends $DEPS | |
| test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1) | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../io \ | |
| ../json \ | |
| ../template | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Verify required sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt | |
| test -f ../path/CMakeLists.txt | |
| test -f ../env/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../async/CMakeLists.txt | |
| test -f ../io/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f ../json/include/vix/json/Simple.hpp | |
| - name: Export dependency include paths | |
| run: | | |
| EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../io/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include" | |
| fi | |
| echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV" | |
| echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV" | |
| - name: Configure valgrind build | |
| run: | | |
| cmake -S . -B build-valgrind -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DVIX_CORE_BUILD_TESTS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=OFF \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_BENCH_MODE=OFF | |
| - name: Build | |
| run: | | |
| cmake --build build-valgrind -j"${BUILD_JOBS}" | |
| - name: Run valgrind on test executables | |
| shell: bash | |
| run: | | |
| set +e | |
| FAIL=0 | |
| mapfile -t TEST_BINS < <( | |
| find build-valgrind/tests -type f -executable 2>/dev/null | sort | |
| ) | |
| if [ ${#TEST_BINS[@]} -eq 0 ]; then | |
| echo "No test executables found for valgrind." | |
| exit 0 | |
| fi | |
| for exe in "${TEST_BINS[@]}"; do | |
| 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 | |
| exit 0 | |
| config-coverage: | |
| name: Configuration Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout core repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends $DEPS | |
| test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1) | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../io \ | |
| ../json \ | |
| ../template | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Verify required sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt | |
| test -f ../path/CMakeLists.txt | |
| test -f ../env/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../async/CMakeLists.txt | |
| test -f ../io/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f ../json/include/vix/json/Simple.hpp | |
| - name: Export dependency include paths | |
| run: | | |
| EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../io/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include" | |
| fi | |
| echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV" | |
| echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV" | |
| - name: Configure release mode | |
| run: | | |
| cmake -S . -B build-release -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_CORE_BUILD_TESTS=OFF \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_CORE_WITH_OPENSSL=ON \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_BENCH_MODE=OFF | |
| - name: Build release mode | |
| run: | | |
| cmake --build build-release -j"${BUILD_JOBS}" | |
| - name: Configure bench mode | |
| run: | | |
| cmake -S . -B build-bench -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_CORE_BUILD_TESTS=OFF \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=OFF \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_BENCH_MODE=ON | |
| - name: Build bench mode | |
| run: | | |
| cmake --build build-bench -j"${BUILD_JOBS}" | |
| summary: | |
| name: Core Strict CI Summary | |
| needs: | |
| - build-test-sanitized | |
| - runtime-smoke | |
| - static-analysis | |
| - valgrind | |
| - config-coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print summary | |
| run: | | |
| echo "Core strict CI completed." | |
| echo "- sanitized builds" | |
| echo "- unit tests" | |
| echo "- runtime smoke checks" | |
| echo "- static analysis" | |
| echo "- valgrind" | |
| echo "- release and bench configuration coverage" |