chore: upgrade Zig 0.12.0 → 0.16.0, Bazel 8.2.1 → 9.0.2, and modernize CI#253
Open
chore: upgrade Zig 0.12.0 → 0.16.0, Bazel 8.2.1 → 9.0.2, and modernize CI#253
Conversation
…e CI
## What
Upgrade three core dependencies and fix all resulting breakage:
- **Zig SDK**: 0.12.0 → 0.16.0 (LLVM 21, new std library APIs)
- **Bazel**: 8.2.1 → 9.0.2 (LTS; removes WORKSPACE, starlarkifies CC rules)
- **wazero**: v1.6.0 → v1.11.0
Update all downstream dependencies to Bazel 9-compatible versions:
bazel_features 1.21.0→1.45.0, platforms 0.0.10→1.0.0,
rules_cc 0.2.14→0.2.17, rules_go 0.54.0→0.60.0, gazelle 0.43.0→0.50.0
Update examples to hermetic_cc_toolchain v4.1.0 (v3.2.0 predates
Bazel 9 support; CcToolchainConfigInfo provider import is incompatible
with the starlarkified rules_cc).
## Why
Zig 0.12.0 was four major versions behind, accumulating migration risk.
Bazel 9.0 is the current LTS and the ecosystem is dropping Bazel 8
compatibility. Staying on old versions blocks upstream contributions
and security fixes.
## How
### Zig 0.16.0 migration
- Bump VERSION and SHA256 hashes for all 6 platforms
- Adapt download URLs: Zig 0.14+ swapped archive naming from
zig-{os}-{arch} to zig-{arch}-{os}
- Migrate zig-wrapper.zig to 0.16.0 std library: process.Init pattern,
std.Io.Dir, process.replace, Environ.createMap, StaticStringMap,
mem.splitScalar
- Migrate rules/cp.zig to process.Init and Io.Dir.copyFile
- Update include paths: any-macos-any→any-darwin-any,
x86_64-linux-gnu→x86-linux-gnu, add generic-musl for WASM
- Add lib/c/** and lib/libtsan/** to linker filegroups
- Filter -mthreads in zig-wrapper (Go CGO + -Werror breakage on Windows)
- Disable ubsan (-fno-sanitize=undefined): Zig 0.16 enables it by
default, causing linker failures when __ubsan_handle_* symbols are
referenced but the runtime library is not linked
- Remove -fsanitize-undefined-strip-path-components from debug features
(same ubsan runtime linkage issue)
- Skip colon_link test (upstream Zig regression ziglang/zig#23287)
### Bazel 9.0.2 migration
- Migrate examples/rules_cc from WORKSPACE to bzlmod
- Delete empty WORKSPACE sentinels (root, examples/bzlmod)
- Add explicit load() for cc_binary/cc_test in BUILD files
(Bazel 9 starlarkified built-in rules)
- Replace @local_config_platform HOST_CONSTRAINTS with [] in test/c/BUILD
- CI: rules_cc example uses override_module instead of override_repository
- Add gazelle_override for buildtools with proto disabled (newer
buildtools references @rules_proto, unavailable from go_deps scope)
### CI improvements
- Split monolithic job into 3 parallel jobs: build-and-test (matrix),
test-examples (ubuntu), lint-and-release (ubuntu)
- Run only Windows-specific tests on windows-latest (was 15+ min
cross-compiling all platforms; Linux/macOS already cover those)
- Skip ci/release when no git tags exist (forks)
- Remove examples/rules_cc/WORKSPACE from releaser boilerplate list
chore: upgrade Zig 0.12.0 → 0.16.0, Bazel 8.2.1 → 9.0.2, and modernize CI
|
|
Why: After the Zig 0.16 / Bazel 9 upgrade, CI started failing on macOS runners with `HTTP Error 403: rate limit exceeded` when calling api.github.com/repos/bazelbuild/bazel/releases. The vendored bazelisk wrapper was falling through to the "latest" version resolution path (which hits the GitHub API) instead of reading the pinned 9.0.2 from .bazelversion. Bazel 9 removed the WORKSPACE file. This repo is now bzlmod-only with just MODULE.bazel at the root, but `find_workspace_root` only looked for WORKSPACE — so it never located the repo root, never read .bazelversion, and fell through to `"latest"`. What: Extend find_workspace_root to also recognize MODULE.bazel, REPO.bazel, and WORKSPACE.bazel as workspace markers. How: Iterate over the known marker filenames in priority order, returning the first directory that contains any of them. Same traversal behavior as before, just more marker names. Outcome: `tools/bazel` now correctly reads .bazelversion (9.0.2) without any network call, so CI no longer depends on unauthenticated GitHub API quota and macOS runners stop failing on rate limits.
fix(tools/bazel): recognize MODULE.bazel as workspace root
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore: upgrade Zig 0.12.0 → 0.16.0, Bazel 8.2.1 → 9.0.2, and modernize CI
What
Upgrade three core dependencies and fix all resulting breakage:
Update all downstream dependencies to Bazel 9-compatible versions:
bazel_features 1.21.0→1.45.0, platforms 0.0.10→1.0.0,
rules_cc 0.2.14→0.2.17, rules_go 0.54.0→0.60.0, gazelle 0.43.0→0.50.0
Update examples to hermetic_cc_toolchain v4.1.0 (v3.2.0 predates
Bazel 9 support; CcToolchainConfigInfo provider import is incompatible
with the starlarkified rules_cc).
Why
Zig 0.12.0 was four major versions behind, accumulating migration risk.
Bazel 9.0 is the current LTS and the ecosystem is dropping Bazel 8
compatibility. Staying on old versions blocks upstream contributions
and security fixes.
How
Zig 0.16.0 migration
zig-{os}-{arch} to zig-{arch}-{os}
std.Io.Dir, process.replace, Environ.createMap, StaticStringMap,
mem.splitScalar
x86_64-linux-gnu→x86-linux-gnu, add generic-musl for WASM
default, causing linker failures when _ubsan_handle* symbols are
referenced but the runtime library is not linked
(same ubsan runtime linkage issue)
Bazel 9.0.2 migration
(Bazel 9 starlarkified built-in rules)
buildtools references @rules_proto, unavailable from go_deps scope)
CI improvements
test-examples (ubuntu), lint-and-release (ubuntu)
cross-compiling all platforms; Linux/macOS already cover those)