-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (78 loc) · 2.81 KB
/
Makefile
File metadata and controls
101 lines (78 loc) · 2.81 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
.PHONY: clean test test-rust test-rust-verbose test-tauri test-common test-ui lint lint-fmt lint-clippy dev build-tauri build-ui setup
# ============================================================================ #
# Load .env file
# ============================================================================ #
ifneq (,$(wildcard .env))
include .env
export
endif
# ============================================================================ #
# CLEAN COMMANDS
# ============================================================================ #
clean:
rm -fr dist/
rm -fr target/
# ============================================================================ #
# LINTING COMMANDS
# ============================================================================ #
# Run all lint checks (formatting + clippy)
lint: lint-fmt lint-clippy pre-commit
pre-commit:
@command -v prek >/dev/null 2>&1 || { \
echo "error: 'prek' is not on PATH."; \
echo " Local devs: run 'make setup' once to install it."; \
echo " CI: install via the 'Install prek' workflow step."; \
exit 127; \
}
prek run -a
# Check formatting
lint-fmt:
cargo fmt --all -- --check
# Run clippy with warnings denied across the whole workspace
lint-clippy:
cargo clippy --workspace --all-targets --all-features -- -D warnings
# ============================================================================ #
# TEST COMMANDS
# ============================================================================ #
# Default: Test EVERYTHING (lint + Rust + WASM UI)
test: test-rust test-ui test-tauri
# Run standard Rust tests (backend + common crate)
test-rust:
cargo test --workspace --exclude speleodb-compass-sidecar-ui
# Run Rust tests with verbose output
test-rust-verbose:
cargo test --workspace --exclude speleodb-compass-sidecar-ui -- --nocapture
# Run only Tauri backend tests
test-tauri:
cargo test -p speleodb-compass-sidecar --lib
# Run only common crate tests
test-common:
cargo test -p common
# Run WASM UI tests (requires wasm-pack)
test-ui:
@if command -v wasm-pack >/dev/null 2>&1; then \
cd app/src && wasm-pack test --headless --firefox; \
else \
echo "wasm-pack not found, skipping UI tests"; \
fi
# ============================================================================ #
# BUILD COMMANDS
# ============================================================================ #
# Build Tauri app
build-tauri:
cd app && \
cargo tauri build
# Build UI for distribution
build-ui:
cd app && \
trunk build --release
# ============================================================================ #
# DEV COMMANDS
# ============================================================================ #
# Install dev tools and set up git hooks
setup:
cargo install --locked cargo-binstall
cargo binstall --locked prek
dev:
cd app && \
cargo tauri dev