Skip to content

Use Bazel for the sanitizer CI jobs - #293

Merged
jbcoe merged 3 commits into
mainfrom
bazel-sanitizers-292
Sep 3, 2026
Merged

Use Bazel for the sanitizer CI jobs#293
jbcoe merged 3 commits into
mainfrom
bazel-sanitizers-292

Conversation

@philipcraig

@philipcraig philipcraig commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Closes #292.

The sanitizer CI jobs now build and test with Bazel instead of CMake. The branch first ran both side by side to compare them; the findings are below.

  • .bazelrc gains asan, ubsan, and tsan configs with the same flags cmake/sanitizers.cmake applies. They use --copt so googletest is instrumented too, and --compilation_mode=dbg so reports carry symbolised stack traces.
  • scripts/bazel.sh takes --asan, --ubsan, and --tsan, mirroring scripts/cmake.sh; --asan with --tsan is rejected. The CMake flags stay for local use.
  • sanitizers.yml sets up Bazel with a per-sanitizer disk cache and runs ./scripts/bazel.sh --asan --ubsan and ./scripts/bazel.sh --tsan. Its paths filters track the Bazel inputs instead of the CMake ones.
  • The change-detection skip moves from job level to step level in cmake.yml, bazel.yml, and sanitizers.yml, so skipped matrix jobs no longer report under the unexpanded name ${{ matrix.settings.name }} ${{ matrix.configuration }}.
  • .bazelignore also ignores .claude, where Claude Code keeps agent worktrees whose build/ directories otherwise make bazel test //... fail to load.
  • Docs updated.

The asan, tsan, and sanitizers check names are unchanged, so the required-check ruleset needs no change.

Findings from four runs with both build systems

Build-and-test step, seconds:

Run cmake asan cmake tsan bazel asan bazel tsan
Cold cache 85 78 91 92
Warm rerun, no change 88 78 21 16
Push after main changed protocol.hh 88 78 61 64
After rebase 89 68 77 65
  • Bazel is never slower than CMake and drops to about 20 s when nothing changed. Whole-job times are equal within noise because the "Install GCC trunk" step (81 to 149 s, mostly the package's mkheaders postinst) dominates both; Cache the installed GCC trunk tree in CI #297 tracks caching it.
  • The setup-bazel disk cache saves only on an exact key miss, so it froze at the first run's contents and later runs stayed partially warm; Save the Bazel disk cache on every CI run #298 tracks saving it per run.

Towards #292. Adds asan, ubsan, and tsan configs to .bazelrc, the matching
--asan/--ubsan/--tsan flags to scripts/bazel.sh, and a build_system
dimension to the sanitizers workflow matrix. The CMake jobs stay until the
Bazel jobs have proven themselves.

.bazelignore also ignores .claude, where Claude Code keeps agent worktrees
whose build/ directories otherwise make bazel test //... fail to load.
A matrix job skipped by its job-level `if:` never expands its matrix and
reports one check under the unexpanded name, e.g.
"${{ matrix.settings.name }} ${{ matrix.configuration }}". Keep the jobs
running and gate every step on the change-detection output instead, so the
expanded names always report.
Four runs of this branch showed the Bazel jobs matching the CMake ones cold
and beating them warm, with the same flags and googletest instrumented too.
@philipcraig philipcraig changed the title Add Bazel sanitizer jobs alongside the CMake ones Use Bazel for the sanitizer CI jobs Sep 3, 2026

@jbcoe jbcoe left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Everything will be a little bit faster to do now.

@jbcoe
jbcoe merged commit ede7922 into main Sep 3, 2026
16 checks passed
@jbcoe
jbcoe deleted the bazel-sanitizers-292 branch September 3, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use bazel for sanitizer runs as the build is faster

2 participants