-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (58 loc) · 2.65 KB
/
Copy pathMakefile
File metadata and controls
78 lines (58 loc) · 2.65 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
# Makefile — MAINTAINERS ONLY
#
# Users do NOT need Make. Install via:
# cargo install schema-risk ← Rust users
# curl -fsSL .../install.sh | bash ← everyone else
.PHONY: build test lint fmt check release clean smoke demo
# ── Development ──────────────────────────────────────────────────────────────
build:
cargo build
release:
cargo build --release
test:
cargo test
test-verbose:
cargo test -- --nocapture
lint:
cargo clippy -- -D warnings
fmt:
cargo fmt --check
fmt-fix:
cargo fmt
# ── Smoke tests (requires the binary in PATH or target/debug) ────────────────
BIN := ./target/debug/schema-risk
smoke: build
@echo "=== safe.sql (expect exit 0) ==="
$(BIN) analyze examples/safe.sql
@echo "\n=== risky.sql (expect exit 1) ==="
-$(BIN) analyze examples/risky.sql
@echo "\n=== critical.sql --fail-on critical (expect exit 2) ==="
-$(BIN) analyze examples/critical.sql --fail-on critical
@echo "\n=== guard --dry-run critical.sql (expect exit 2) ==="
-$(BIN) guard --dry-run examples/critical.sql
@echo "\n=== fix risky.sql --dry-run (expect diff) ==="
$(BIN) fix examples/risky.sql --dry-run
@echo "\n=== ci-report complex.sql ==="
$(BIN) ci-report examples/complex.sql --format github-comment
@echo "\n=== init --force ==="
$(BIN) init --force && rm -f schema-risk.yml
@echo "\n✅ Smoke tests passed"
demo: build
@echo "╔═══════════════════════════════════════╗"
@echo "║ SchemaRisk Live Demo ║"
@echo "╚═══════════════════════════════════════╝"
$(BIN) analyze examples/critical.sql --verbose
# ── Quality gate (run before pushing / tagging) ──────────────────────────────
check: fmt lint test smoke
@echo "✅ All checks passed"
# ── Cross-compile release artifacts for GitHub Actions ───────────────────────
dist:
cargo build --release --target x86_64-unknown-linux-musl
cargo build --release --target x86_64-apple-darwin
cargo build --release --target aarch64-apple-darwin
cargo build --release --target x86_64-pc-windows-gnu
clean:
cargo clean
# ── crates.io publish ────────────────────────────────────────────────────────
publish: check
cargo publish