-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
177 lines (137 loc) · 5.18 KB
/
Makefile
File metadata and controls
177 lines (137 loc) · 5.18 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Makefile for StoreMy (Rust workspace). See CONTRIBUTING.md.
.DEFAULT_GOAL := help
.PHONY: test quick-test ci-test cargo-test test-watch test-watch-rust test-coverage \
clean rust-clean \
build \
fmt rust-fmt rust-fmt-check rust-fmt-install install-hooks uninstall-hooks \
clippy rust-clippy rust-lint rust-deny rust-machete rust-typos rust-watch rust-audit \
lint \
check \
install-tools help \
docker-demo docker-test docker-build docker-clean docker-stop quickstart
# ----- Rust (default; workspace root = repository root) -----
# Nightly pin used ONLY for rustfmt (rustfmt.toml relies on unstable options).
# Build/test/clippy use the stable toolchain from rust-toolchain.toml.
RUSTFMT_TOOLCHAIN := nightly-2026-04-01
rust-fmt-install:
rustup toolchain install $(RUSTFMT_TOOLCHAIN) --component rustfmt --profile minimal
rust-fmt:
cargo +$(RUSTFMT_TOOLCHAIN) fmt --all
rust-fmt-check:
cargo +$(RUSTFMT_TOOLCHAIN) fmt --all -- --check
# ----- Git hooks (tracked in tools/git-hooks) -----
install-hooks:
git config core.hooksPath tools/git-hooks
@echo "Git hooks enabled (core.hooksPath = tools/git-hooks)."
@echo "Use 'SKIP_HOOKS=1 git commit ...' to bypass once."
uninstall-hooks:
git config --unset core.hooksPath || true
@echo "Git hooks disabled."
rust-clippy:
cargo clippy --workspace --all-targets -- -D warnings
rust-deny:
cargo deny check
rust-machete:
cargo machete
rust-typos:
typos
rust-watch:
bacon
rust-audit: rust-deny rust-machete rust-typos
rust-lint: rust-clippy
rust-test:
cargo nextest run --workspace
rust-nextest:
cargo nextest run --workspace
quick-test:
cargo nextest run -p storemy --lib
ci-test:
cargo nextest run --workspace --profile ci
cargo-test:
cargo test --workspace
rust-build:
cargo build --workspace
rust-build-release:
cargo build --workspace --release
rust-clean:
cargo clean
# Default developer targets
fmt: rust-fmt
clippy: rust-clippy
test: rust-test
build: rust-build
check: rust-fmt rust-clippy ci-test
lint: rust-clippy
test-watch-rust:
@echo "Watching db/src for changes (Rust tests)..."
@echo "Press Ctrl+C to stop"
@cargo nextest run --workspace
@while inotifywait -e modify,create,delete -r db/src 2>/dev/null; do \
echo "$$(date): Running cargo nextest run --workspace"; \
cargo nextest run --workspace; \
echo ""; \
done
test-watch: test-watch-rust
test-coverage:
cargo nextest run --workspace
@echo "Tip: install cargo-llvm-cov for LCOV/HTML: cargo llvm-cov test --workspace"
# ----- Housekeeping -----
clean: rust-clean
install-tools:
@echo "Installing file watching tools..."
sudo apt-get update && sudo apt-get install -y inotify-tools mold clang || true
@echo "Optional: cargo install cargo-nextest cargo-watch bacon typos-cli --locked"
@echo "Tools installation complete!"
help:
@echo "StoreMy — Rust workspace (see CONTRIBUTING.md)"
@echo ""
@echo "Docker:"
@echo " make docker-demo - Interactive REPL (docker compose up storemy)"
@echo " make docker-test - Integration tests (docker compose run storemy-test)"
@echo " make docker-build - Build images"
@echo " make docker-clean - Remove containers/volumes"
@echo " make docker-stop - Stop containers"
@echo " make quickstart - docker-build + docker-demo"
@echo ""
@echo "Rust (default):"
@echo " test / rust-test - cargo nextest run --workspace"
@echo " rust-nextest - cargo nextest run (install cargo-nextest)"
@echo " quick-test - cargo nextest run -p storemy --lib"
@echo " ci-test - cargo nextest run --workspace --profile ci"
@echo " cargo-test - cargo test --workspace"
@echo " fmt / rust-fmt - cargo +nightly fmt --all (uses pinned nightly)"
@echo " rust-fmt-check - fmt --check (same nightly)"
@echo " rust-fmt-install - install pinned nightly + rustfmt component"
@echo " install-hooks - enable tools/git-hooks (pre-commit fmt+clippy)"
@echo " uninstall-hooks - disable the repo git hooks"
@echo " clippy - clippy -D warnings"
@echo " rust-deny - cargo deny check (licenses/CVEs/dups)"
@echo " rust-machete - unused deps"
@echo " rust-typos - source-code spell check (install: cargo install typos-cli)"
@echo " rust-watch - bacon background checker (install: cargo install bacon)"
@echo " rust-audit - deny + machete + typos"
@echo " build - cargo build --workspace"
@echo " check - fmt + clippy + ci-test"
@echo " test-watch - inotify + cargo nextest on db/src changes"
@echo " rust-clean - cargo clean"
@echo ""
@echo " install-tools, help"
# ============================================
# Docker
# ============================================
docker-demo:
@echo "Starting StoreMy REPL (Rust). Ctrl+C to stop."
docker compose up storemy
docker-test:
@echo "Running Rust integration tests in Docker..."
docker compose run --rm storemy-test
docker-build:
@echo "Building Docker images..."
docker compose build
docker-clean:
@echo "Cleaning up Docker containers and volumes..."
docker compose down -v
docker-stop:
@echo "Stopping Docker containers..."
docker compose down
quickstart: docker-build docker-demo