bench: add missing crash-recovery benchmark source (#41) #122
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: CI | |
| # Full build + test matrix for every push to main and every pull request. | |
| # | |
| # Matrix (6 jobs total): | |
| # | |
| # Windows Release static <- bundled thirdparty on Windows, fast baseline | |
| # Windows Release shared <- validates DLL + import-lib path | |
| # Windows Debug static <- catches debug-only issues (asserts, iterator debug) | |
| # Linux Release static <- system protobuf via apt; flatbuffers + zstd from FetchContent | |
| # Linux Release shared <- validates .so + RPATH install layout | |
| # Linux Debug static <- catches UBsan-friendly issues under Debug asserts | |
| # | |
| # GUI tools (vtx_inspector, vtx_schema_creator) are disabled in CI -- they | |
| # fetch ImGui + GLFW, take ~2x as long to build, and still contain Windows-only | |
| # glue that makes them flaky on Linux. They get tested manually until someone | |
| # ports the INI-based settings persistence to XDG. | |
| # | |
| # The CLI tool (vtx_cli) and all five samples stay ON. `ctest` runs the full | |
| # 187-test suite plus the sample smoke tests registered in tests/CMakeLists.txt. | |
| on: | |
| push: | |
| branches: [main, master] | |
| # Skip the build matrix on docs-only commits. Specifically lets the | |
| # release workflow's CHANGELOG rotation commit on main land without | |
| # spinning up a 30-min build that would test no code change. We | |
| # used to do this with [skip ci] in the bot's commit message, but | |
| # that string survived `git revert` and accidentally suppressed the | |
| # release.yml trigger on retags -- paths-ignore keys off the actual | |
| # changed files instead, immune to message preservation. | |
| paths-ignore: | |
| - 'CHANGELOG.md' | |
| pull_request: | |
| branches: [main, master] | |
| # When a new commit lands on the same PR, cancel the previous CI run. | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ========================================================================== | |
| # clang-format check. Runs on LINES changed by the current PR / push, not | |
| # on the whole file -- 90% of the codebase pre-dates the .clang-format | |
| # file so a strict full-repo check (or even full-file check on any file | |
| # that happens to be touched) would be permanently red. This "diff gate" | |
| # catches new formatting regressions without requiring a one-time style- | |
| # sweep commit. When you're ready to sweep, run locally: | |
| # | |
| # clang-format -i $(find sdk tools samples tests \ | |
| # -type f \( -name "*.cpp" -o -name "*.cc" -o -name "*.h" -o -name "*.hpp" \) \ | |
| # -not -path "*/generated/*" -not -name "*_generated.h" \ | |
| # -not -path "*portable-file-dialogs.h") | |
| # | |
| # and commit with --git-blame-ignore-revs to preserve blame. | |
| # ========================================================================== | |
| clang-format: | |
| name: clang-format (changed lines) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout (with history for diff) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install clang-format | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format-15 | |
| sudo ln -sf "$(command -v clang-format-15)" /usr/local/bin/clang-format | |
| clang-format --version | |
| - name: clang-format (changed lines only) | |
| run: | | |
| # Diff-only gate: only LINES touched in this PR / push get checked, | |
| # so legacy files (pre .clang-format) aren't dragged into a sweep. | |
| # The actual filtering, exclude rules and clang-format-diff invocation | |
| # live in scripts/check_clang_format.py -- single source of truth | |
| # shared with the local pre-push hook (scripts/git-hooks/pre-push). | |
| # | |
| # PR: diff against the merge base of the PR. Push: diff against | |
| # the previous commit on the same branch. | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| BASE="origin/${{ github.base_ref }}" | |
| git fetch origin "${{ github.base_ref }}" --depth=1 | |
| else | |
| BASE="HEAD~1" | |
| fi | |
| python scripts/check_clang_format.py --base "$BASE" | |
| build-test: | |
| name: ${{ matrix.label }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # ---- Windows ------------------------------------------------------ | |
| # Pinned to windows-2022 (Visual Studio 17 2022) rather than | |
| # windows-latest: the latter now defaults to a newer VS generator | |
| # (e.g. "Visual Studio 18 2026"), which mismatches the generator | |
| # baked into the cached build/_deps FetchContent subbuild trees and | |
| # fails the flatbuffers populate step. Pinning keeps the default | |
| # generator stable and matches the local dev toolchain; the | |
| # windows-2022 cache-key prefix also discards any mismatched cache. | |
| - label: Windows / Release / static | |
| os: windows-2022 | |
| build_type: Release | |
| vtx_shared: "OFF" | |
| extra_cmake: -A x64 | |
| - label: Windows / Release / shared | |
| os: windows-2022 | |
| build_type: Release | |
| vtx_shared: "ON" | |
| extra_cmake: -A x64 | |
| - label: Windows / Debug / static | |
| os: windows-2022 | |
| build_type: Debug | |
| vtx_shared: "OFF" | |
| extra_cmake: -A x64 | |
| # ---- Linux -------------------------------------------------------- | |
| - label: Linux / Release / static | |
| os: ubuntu-latest | |
| build_type: Release | |
| vtx_shared: "OFF" | |
| extra_cmake: -DCMAKE_BUILD_TYPE=Release | |
| - label: Linux / Release / shared | |
| os: ubuntu-latest | |
| build_type: Release | |
| vtx_shared: "ON" | |
| extra_cmake: -DCMAKE_BUILD_TYPE=Release | |
| - label: Linux / Debug / static | |
| os: ubuntu-latest | |
| build_type: Debug | |
| vtx_shared: "OFF" | |
| extra_cmake: -DCMAKE_BUILD_TYPE=Debug | |
| - label: Linux / ASan+UBSan / Debug | |
| os: ubuntu-latest | |
| build_type: Debug | |
| vtx_shared: "OFF" | |
| extra_cmake: -DCMAKE_BUILD_TYPE=Debug -DVTX_SANITIZE=address,undefined | |
| sanitizer: "asan_ubsan" | |
| - label: Linux / TSan / Debug | |
| os: ubuntu-latest | |
| build_type: Debug | |
| vtx_shared: "OFF" | |
| extra_cmake: -DCMAKE_BUILD_TYPE=Debug -DVTX_SANITIZE=thread | |
| sanitizer: "tsan" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # ---------------------------------------------------------------------- | |
| # Linux needs protobuf + protoc from apt. FlatBuffers and zstd are | |
| # both built from source through FetchContent -- see | |
| # cmake/VtxDependencies.cmake -- so no libflatbuffers-dev / | |
| # libzstd-dev packages. Windows uses the bundled thirdparty | |
| # binaries (VTX dependency resolver falls back to BUNDLED when no | |
| # vcpkg toolchain is provided). | |
| # ---------------------------------------------------------------------- | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| cmake \ | |
| g++ \ | |
| ninja-build \ | |
| protobuf-compiler \ | |
| libprotobuf-dev | |
| # ---------------------------------------------------------------------- | |
| # TSan's shadow-memory layout breaks on kernels with high ASLR entropy | |
| # (vm.mmap_rnd_bits=32 by default on recent Ubuntu). Pin to 28 for | |
| # sanitizer jobs only. See https://github.com/google/sanitizers/issues/1716 | |
| # ---------------------------------------------------------------------- | |
| - name: Relax ASLR entropy for sanitizer runtime | |
| if: matrix.sanitizer != '' | |
| run: sudo sysctl -w vm.mmap_rnd_bits=28 | |
| # ---------------------------------------------------------------------- | |
| # Cache CMake FetchContent output (GoogleTest) so repeat CI runs don't | |
| # re-clone + re-compile gtest. Keyed on every CMakeLists + cmake module | |
| # so any change to the build graph invalidates the cache. | |
| # ---------------------------------------------------------------------- | |
| - name: Cache FetchContent | |
| uses: actions/cache@v4 | |
| with: | |
| path: build/_deps | |
| key: ${{ matrix.os }}-deps-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake', 'tests/CMakeLists.txt', 'tools/CMakeLists.txt', 'sdk/src/**/CMakeLists.txt', 'samples/CMakeLists.txt') }} | |
| restore-keys: | | |
| ${{ matrix.os }}-deps- | |
| # ---------------------------------------------------------------------- | |
| # Configure. GUI tools disabled everywhere for CI speed. | |
| # ---------------------------------------------------------------------- | |
| - name: Configure | |
| run: > | |
| cmake -S . -B build | |
| ${{ matrix.extra_cmake }} | |
| -DVTX_BUILD_SHARED=${{ matrix.vtx_shared }} | |
| -DBUILD_VTX_INSPECTOR=OFF | |
| -DBUILD_VTX_SCHEMA_CREATOR=OFF | |
| - name: Build | |
| run: cmake --build build --config ${{ matrix.build_type }} --parallel | |
| - name: Test | |
| working-directory: build | |
| env: | |
| # Sanitizer runtime options -- harmless when no sanitizer is active | |
| # (the uninstrumented binary ignores them). | |
| ASAN_OPTIONS: "detect_leaks=1:check_initialization_order=1:strict_init_order=1:abort_on_error=1:symbolize=1" | |
| UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1:symbolize=1" | |
| TSAN_OPTIONS: "halt_on_error=1:second_deadlock_stack=1:history_size=7:symbolize=1" | |
| LSAN_OPTIONS: "suppressions=${{ github.workspace }}/tests/sanitizer_suppressions/lsan.supp" | |
| run: ctest --output-on-failure -C ${{ matrix.build_type }} --parallel --timeout 180 | |
| # ---------------------------------------------------------------------- | |
| # On failure, upload ctest logs + any artefacts the test suite dropped | |
| # under tests/test_output so the dev can inspect what went wrong. | |
| # ---------------------------------------------------------------------- | |
| - name: Upload test artefacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: failure-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.vtx_shared }} | |
| path: | | |
| build/Testing/** | |
| build/tests/test_output/** | |
| if-no-files-found: ignore | |
| retention-days: 7 |