-
-
Notifications
You must be signed in to change notification settings - Fork 1
CI and Testing
Open-Lotto Wiki edited this page Jun 5, 2026
·
1 revision
The CI pipeline runs on every push and pull request. It has 6 jobs:
| Job | Compiler(s) | What it checks |
|---|---|---|
build-and-test |
GCC + Clang (matrix) | Release build compiles and all CTest tests pass |
format-check |
— | All source files comply with .clang-format
|
sanitizers |
GCC + Clang (matrix) | Debug build with ASan + UBSan finds no issues |
static-analysis |
— | cppcheck + clang-tidy report no errors |
coverage |
GCC | Line coverage ≥ 70% (lcov) |
A pull request must pass all 6 jobs before merge.
16 tests are registered with CTest:
| Test name | Type | Description |
|---|---|---|
unit_combogen |
Unit | 23 cases: uniqueness, range, boundaries, error handling |
unit_plugin_loader |
Unit | Plugin discovery and symbol resolution |
unit_export |
Unit | CSV and JSON output correctness |
cli_lotto_success |
CLI integration | Exit 0 for valid Lotto run |
cli_eurojackpot_success |
CLI integration | Exit 0 for valid Eurojackpot run |
cli_list_games_success |
CLI integration |
--list-games exits 0 |
cli_*_fail (9 tests) |
CLI integration | Invalid arguments exit non-zero (WILL_FAIL) |
# Run all tests
ctest --test-dir build --output-on-failure
# Run a specific test
ctest --test-dir build -R unit_combogen --output-on-failure
# List all registered tests
ctest --test-dir build -NThe project uses LLVM style with a 100-character column limit (.clang-format).
# Check (non-destructive)
clang-format -n -Werror $(find src plugins include tests -name "*.c" -o -name "*.h")
# Fix all files in-place
clang-format -i $(find src plugins include tests -name "*.c" -o -name "*.h")Or use the helper script:
scripts/run_format_check.shscripts/run_cppcheck.shThe .clang-tidy config enables: clang-analyzer, bugprone, cert, misc, performance, portability.
scripts/run_clang_tidy.shscripts/run_sanitizers.shOr build manually:
cmake -S . -B build-sanitizer \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTING=ON \
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined -g"
cmake --build build-sanitizer -j
ctest --test-dir build-sanitizer --output-on-failurescripts/run_coverage.shGenerates an HTML report via lcov. The CI enforces a minimum threshold of 70%.
Install once to run all 4 quality gates automatically before every commit:
scripts/install-git-hooks.shThe pre-commit hook runs in order:
scripts/run_format_check.shscripts/run_cppcheck.shscripts/run_clang_tidy.shscripts/run_sanitizers.sh
If any gate fails, the commit is blocked.
Throughput benchmarks are in tests/benchmark.c:
| Metric | Approximate value |
|---|---|
| Eurojackpot draws/sec | ~195 k |
| Lotto 6aus49 draws/sec | ~241 k |
Run benchmarks:
scripts/run_benchmarks.sh
# or
./build/benchmarkResults are written to build/benchmark_results.json.