Skip to content

Bazel build with nogo, replace CI with single Bazel job - #37

Merged
birdayz merged 4 commits into
mainfrom
jb/bazel
Mar 13, 2026
Merged

birdayz merged 4 commits into
mainfrom
jb/bazel

Conversation

@birdayz

@birdayz birdayz commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

What

Replace the multi-job Go CI pipeline (test + bazel + lint) with a single Bazel job that handles build, test, and static analysis via nogo.

Why

Three separate CI jobs each doing their own setup (Go, Buf, golangci-lint) is slow and redundant. Bazel with nogo runs everything in one pass with proper caching -- 38s warm vs 2min cold.

Implementation details

  • Single build job on Blacksmith 2-vCPU runner, bazelisk test //... does it all
  • nogo configured with 50+ staticcheck analyzers (SA*, S1*, ST*, QF*), replacing golangci-lint
  • nogo_config.json excludes third-party deps from analysis, disables false-positive analyzers (shadow, loopclosure)
  • Bazel caching: disk-cache (keyed by branch), repository-cache, bazelisk-cache -- all via useblacksmith/setup-bazel@v1
  • tools.go added to pin staticcheck dependency for nogo
  • Removed: setup-go, setup-buf, golangci-lint, manual go test, manual example builds -- Bazel handles all of it

References

Blacksmith setup-bazel: https://github.com/useblacksmith/setup-bazel

birdayz and others added 4 commits March 12, 2026 21:46
Major restructuring that adds Bazel 9 build support and replaces the
old shell-based golden test infrastructure with a proper in-process
Go test.

The gen/go-golden directory is gone. The checked-in gen/go/*.pb.mcp.go
files ARE the golden files now. TestGoldenGeneration rebuilds them
from compiled proto descriptors (patched with source_code_info from a
buf-built FileDescriptorSet) and diffs against the checked-in copies.
Works in both Bazel and go test, no shell, no protoc, no buf at test
time.

Other changes in this batch:
- Extract core schema logic into pkg/gen (reusable library, independent
  of protoc plugin machinery)
- Add dynamic/reflection-based MCP registration (gen.RegisterService)
- Edge case protos and tests for deep nesting, all scalar types, map
  variants, multiple oneofs, numeric validation
- Conformance test framework for Anthropic, OpenAI, Google Gemini
- FixOpenAI improvements: handle repeated messages, map values, JSON
  names
- Bazel BUILD files for all packages, MODULE.bazel, .bazelrc
- Handler e2e tests, fuzz tests, extra properties integration tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add bazelisk test job to GitHub Actions CI. Set size="small" on all
three test targets to match their actual <1s execution time. Remove
stale golden-files and buf-lint CI jobs, update justfile to run all
tests including conformance/integration, clean up TODO and CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enable nogo in the Bazel build with stdlib analyzers (nilness, errorsas,
copylock, printf, etc.) and all staticcheck SA analyzers. Zero findings
in our code.

Consolidate the three separate CI jobs (go test, golangci-lint,
buf-lint) into a single Bazel job on Blacksmith runners. nogo runs
static analysis as part of the build, so linting and testing happen
in one pass. No more fragile multi-job CI with separate tool setups.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All three cache layers were disabled by default in setup-bazel,
causing full rebuilds (~1100 actions) on every run. Enable
bazelisk, disk, and repository caches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@birdayz birdayz changed the title Bazel build, pkg/gen extraction, in-process golden tests Bazel build with nogo, replace CI with single Bazel job Mar 13, 2026
@birdayz
birdayz merged commit ff95400 into main Mar 13, 2026
3 checks passed
@birdayz
birdayz deleted the jb/bazel branch March 13, 2026 09:51
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.

2 participants