-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (109 loc) · 5.52 KB
/
Copy pathMakefile
File metadata and controls
132 lines (109 loc) · 5.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
BINARY := lore
FEATURES := --all-features
# Stricter warnings for CI / check target
export RUSTFLAGS ?= -W dead_code -W unused_imports -W unused_variables -W unused_mut
.DEFAULT_GOAL := help
.PHONY: build install update fmt fmt-fix lint-conventions lint test-quick test dist-check fuzz doc generate-docs check-docs check ci-local setup clean help
# Prerequisites:
# ocr feature: cmake must be installed (used by kreuzberg-tesseract)
## build: Build the binary (release, all features)
build:
cargo build --release --package lore-cli $(FEATURES)
## install: Install the binary via cargo install
install:
cargo install --force --locked --path cli $(FEATURES)
## update: Update all Cargo dependencies
update:
cargo update
## fmt: Check formatting (fails on diff)
fmt:
cargo fmt -- --check
## fmt-fix: Fix formatting (destructive)
fmt-fix:
cargo fmt
## lint-conventions: Check code conventions (unwrap, import order, pub visibility)
lint-conventions:
scripts/lint-conventions.sh
## lint: Run clippy (all feature combos)
lint:
cargo clippy --workspace --all-targets $(FEATURES) -- -D warnings
cargo clippy --workspace --all-targets -- -D warnings
# xtask must be excluded from every featureless run. It depends on lore and
# lore-cli with `llm,mcp,s3` enabled (deliberately: it generates the docs from
# the full CLI surface, so dropping those silently deletes rows from the
# generated tables), and Cargo unifies features across a workspace. Without
# --exclude, `--workspace --no-default-features` enables `ingest` anyway and
# lints nothing featureless: a broken featureless build sat on main for weeks
# with this gate green. Measured at 7b7996a: --workspace = 0 errors,
# --workspace --exclude xtask = 18.
cargo clippy --workspace --exclude xtask --all-targets --no-default-features -- -D warnings
# Also per-package, so a future workspace member that enables lore/llm cannot
# re-poison the run above the way xtask did. These two are what actually ship:
# the featureless library, and lore-cli as a search-only binary.
cargo clippy -p lore --all-targets --no-default-features -- -D warnings
cargo clippy -p lore-cli --all-targets --no-default-features -- -D warnings
## test-quick: Run tests (default features only)
test-quick:
# --workspace, or Cargo runs only the root `lore` package and skips
# lore-cli's integration suite entirely.
cargo test --workspace
## test: Run tests (all feature combos)
test:
cargo test --workspace $(FEATURES)
# --exclude xtask for the same feature-unification reason as `lint` above.
cargo test --workspace --exclude xtask --no-default-features
cargo test --workspace
## dist-check: Build the profile that actually SHIPS (fat-LTO release, slow)
### `[profile.dist]` in Cargo.toml is what cargo-dist publishes to the Homebrew tap,
### and nothing built it: `make build` and `make test` both use dev/test profiles. LTO
### and codegen-units=1 fail at LINK time, so a `cargo check` cannot see those failures
### and only a real BUILD can. Manual rather than part of `check` because a fat-LTO
### build is minutes, not seconds; run it before cutting a release.
### The changelog check rides here because dist-check IS the release gate: at a
### version bump "does CHANGELOG.md document this version" is mechanical, while a
### per-commit rule would fail every refactor and train whitespace-line appeasement.
dist-check:
scripts/changelog-release-check.sh
cargo build --profile dist --workspace
## fuzz: Run all fuzz targets for 60 seconds each (requires cargo-fuzz and nightly)
fuzz:
@command -v rustup >/dev/null 2>&1 || { echo "error: rustup is required for fuzz (cargo +nightly). Install from https://rustup.rs"; exit 1; }
@rustup run nightly cargo --version >/dev/null 2>&1 || { echo "error: nightly toolchain not installed. Run: rustup toolchain install nightly"; exit 1; }
@rustup run nightly cargo fuzz --version >/dev/null 2>&1 || { echo "error: cargo-fuzz not installed. Run: cargo install cargo-fuzz"; exit 1; }
$(eval NIGHTLY_BIN := $(shell rustup run nightly rustc --print sysroot)/bin)
PATH="$(NIGHTLY_BIN):$(PATH)" cargo fuzz run fuzz_sanitize_query -- -max_total_time=60
PATH="$(NIGHTLY_BIN):$(PATH)" cargo fuzz run fuzz_visible_width -- -max_total_time=60
PATH="$(NIGHTLY_BIN):$(PATH)" cargo fuzz run fuzz_config_parse -- -max_total_time=60
## doc: Build docs (fails on warnings)
doc:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace $(FEATURES)
## generate-docs: Regenerate doc tables from code annotations
generate-docs:
cargo run --package xtask -- generate-docs
## check-docs: Verify doc tables are up to date
check-docs: generate-docs
@git diff --exit-code -- docs/ skills/ \
|| { echo "Doc tables are stale. Run: cargo xtask generate-docs"; exit 1; }
## check: Run all quality gates (fmt lint-conventions lint doc test check-docs deny)
check: fmt lint-conventions lint doc test check-docs
@if command -v cargo-deny >/dev/null 2>&1; then \
cargo deny check; \
cargo deny --manifest-path fuzz/Cargo.toml check advisories; \
else \
echo "note: cargo-deny not installed; skipping license/advisory check (run: cargo install cargo-deny)"; \
fi
## ci-local: Run CI workflow locally via act (ubuntu matrix only)
ci-local:
@command -v act >/dev/null 2>&1 || { echo "error: act not installed. Run: brew install act"; exit 1; }
act push -W .github/workflows/ci.yml
## setup: Install git hooks (run once after cloning)
setup:
scripts/install-hooks.sh
## clean: Remove build artifacts
clean:
cargo clean
## help: Show this help
help:
@echo "lore Makefile"
@echo ""
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //' | column -t -s ':'