Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
- "src/codegen/**"
- "scripts/build/**"
- "scripts/build.ts"
- "scripts/rust-clippy-cross.ts"
- "scripts/rust-clippy-cross-budgets.json"
- "Cargo.toml"
- "Cargo.lock"
- "clippy.toml"
Expand All @@ -26,8 +28,9 @@ env:
BUN_VERSION: "1.3.14"
LLVM_VERSION_MAJOR: "21"
# Pin the toolchain explicitly so rustup ignores rust-toolchain.toml's
# `targets` list (11 cross triples ≈ 450 MB of prebuilt std we don't need
# to lint the host). Keep in sync with `channel` in rust-toolchain.toml.
# `targets` list (11 cross triples ≈ 450 MB of prebuilt std); the Setup Rust
# step adds the std of just the triples `rust:clippy-cross` lints. Keep in
# sync with `channel` in rust-toolchain.toml.
RUSTUP_TOOLCHAIN: nightly-2026-07-20

jobs:
Expand Down Expand Up @@ -59,12 +62,16 @@ jobs:

- name: Setup Rust
run: |
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --component clippy
# The budget file's keys are the triples the cross step lints; clippy
# needs their rust-std and nothing else.
cross_targets=$(bun -e 'console.log(Object.keys(await Bun.file("scripts/rust-clippy-cross-budgets.json").json()).join(","))')
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --component clippy --target "$cross_targets"
rustup override set "$RUSTUP_TOOLCHAIN"
# rustc/clippy diagnostics → inline PR annotations
echo "::add-matcher::.github/rust-matcher.json"

- name: Generate codegen
id: codegen
# bun_runtime/bun_jsc/bun_core `include!()` files under
# build/debug/codegen/; clippy can't lint those crates without them.
# `clone-lolhtml` fetches the vendored Rust path-dep
Expand All @@ -78,3 +85,13 @@ jobs:
env:
BUN_CODEGEN_DIR: ${{ github.workspace }}/build/debug/codegen
run: bun run rust:clippy

- name: cargo clippy (cross targets)
# Code gated on another OS / arch / libc is invisible to the host run
# above; this lints it per target against the per-file budgets in
# scripts/rust-clippy-cross-budgets.json. Runs even when the host run
# failed so a PR gets both sets of diagnostics at once.
if: ${{ !cancelled() && steps.codegen.outcome == 'success' }}
env:
BUN_CODEGEN_DIR: ${{ github.workspace }}/build/debug/codegen
run: bun run rust:clippy-cross
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Several situational sections live in `.claude/docs/landing-prs.md` — read the
6. **Use absolute paths** - Always use absolute paths in file operations
7. **Avoid shell commands** - Don't use `find` or `grep` in tests; use Bun's Glob and built-in tools
8. **Memory management** - Prefer RAII (`Drop`) over manual cleanup. Arena edge case: values allocated in an arena (`Arena<T>`/`bumpalo`) do **not** run `Drop` on arena reset — types owning a heap allocation or refcount must be freed/deref'd explicitly first, mirroring the original Zig `deinit()` order.
9. **Cross-platform** - Run `bun run rust:check-all` to compile across all targets (linux/macos/windows × x64/aarch64) when making platform-specific changes. `#[cfg(...)]`-gated code is not type-checked unless the matching target is built.
9. **Cross-platform** - Run `bun run rust:check-all` to compile across all targets (linux/macos/windows × x64/aarch64) when making platform-specific changes. `#[cfg(...)]`-gated code is not type-checked unless the matching target is built. Same for clippy: CI lints the Linux host plus the targets in `scripts/rust-clippy-cross-budgets.json` (per-file budgets of the remaining hits), so also run `bun run rust:clippy-cross` when touching `cfg(windows)` / `cfg(target_os = ...)` code.
10. **Debug builds** - Use `BUN_DEBUG_QUIET_LOGS=1` to disable debug logging, or `BUN_DEBUG_<SCOPE>=1` to enable a specific `bun_core::output` scoped logger
11. **Be humble & honest** - NEVER overstate what you got done or what actually works in commits, PRs or in messages to the user.
12. **Branch names must start with `claude/`** - This is a requirement for the CI to work.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"rust:check": "cargo check --workspace --keep-going",
"rust:check-all": "bun scripts/rust-check-all.ts",
"rust:clippy": "cargo clippy --workspace --no-deps --keep-going",
"rust:clippy-cross": "bun scripts/rust-clippy-cross.ts",
"rust:miri": "bun scripts/rust-miri.ts",
"rust:timings": "bun scripts/rust-timings.ts",
"codegen:string-maps": "for f in src/**/*.string-map.ts; do bun src/codegen/generate-string-map.ts \"$f\" \"${f%.string-map.ts}.generated.rs\"; done",
Expand Down
Loading