Skip to content

Add Bazel build system - #1

Open
zjfroot wants to merge 9 commits into
mainfrom
bazel-migration
Open

zjfroot wants to merge 9 commits into
mainfrom
bazel-migration

Conversation

@zjfroot

@zjfroot zjfroot commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a complete Bazel build system to the GitHub CLI, enabling reproducible builds and fast incremental compilation.

What's included

  • 257 BUILD.bazel files auto-generated by Gazelle
  • MODULE.bazel with rules_go 0.60.0, gazelle 0.45.0, rules_proto, protobuf
  • Fixed proto BUILD files for gRPC codegen (dual go_proto + go_grpc_v2 compilers)
  • Fixed certificate-transparency-go external dep Bzlmod compatibility
  • Added data dependencies for 20 previously failing tests
  • 199/200 tests pass

Build & Test

bazel build //cmd/gh:gh    # builds the gh binary
bazel test //...           # 199/200 pass

Known issue

//git:git_test fails due to CWD mismatch — go_test CWD is the runfiles root while test data files are placed at a subdirectory. This is a known Bazel limitation with bare git repos in the sandbox.

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

zjfroot added 7 commits June 21, 2026 20:02
- MODULE.bazel with rules_go, gazelle, rules_proto, protobuf
- 257 BUILD.bazel files auto-generated by Gazelle
- Fixed proto BUILD files for gRPC codegen
- Fixed certificate-transparency-go external dep compatibility
- Added test data dependencies for 20 previously failing tests
- 199/200 tests pass (git_test requires wrapper for CWD)

Built and tested with Bazel 9.0.0
…sparency-go

The 'clean' build_file_generation mode prevented Gazelle from generating
BUILD files for certificate-transparency-go, causing missing dependency
errors for the configpb sub-package. Switch to 'auto' with proto mode
disabled so Gazelle generates correct go_library rules.
…sues

Bazel's linux-sandbox prevents git subprocesses from accessing data files
through the runfiles directory. Copy the simple.git fixture to a temp
directory so git can read it directly.
zjfroot added 2 commits June 21, 2026 20:16
Document how to build and test with Bazel, including Gazelle usage,
the certificate-transparency-go override, and the git test sandbox
workaround. Update project-layout.md to reference the new doc.
Create cross-agent Bazel skill files that point to docs/bazel.md as the
single source of truth. Each agent gets a thin quick-reference wrapper
with commands, common fixes, and project quirks inline.
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