-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathjustfile
More file actions
94 lines (71 loc) · 2.72 KB
/
justfile
File metadata and controls
94 lines (71 loc) · 2.72 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
set dotenv-load
# Defaults (overridden by .env or environment)
CONTAINER_RUNTIME := env("CONTAINER_RUNTIME", "podman")
DATABASE_URL := env("DATABASE_URL", "postgresql://root@localhost:26257/tokf_test?sslmode=disable")
compose_file := "crates/tokf-server/docker-compose.yml"
# Run all checks
check: fmt-check lint test file-size
# Format code
fmt:
cargo fmt
# Check formatting
fmt-check:
cargo fmt -- --check
# Run unit tests (no database required)
test:
cargo test
# Run declarative filter test suites (tokf verify)
verify:
cd crates/tokf-cli && cargo run --quiet --bin tokf -- verify
# Run clippy
lint:
cargo clippy --workspace --all-targets -- -D warnings
# Check file sizes
file-size:
bash scripts/check-file-sizes.sh
# Install the CLI
install:
cargo install --path crates/tokf-cli
# Install the CLI (force)
force-install:
cargo install --force --path crates/tokf-cli
# Generate README.md from docs/
readme:
bash scripts/generate-readme.sh
# Verify README.md is up-to-date
readme-check:
bash scripts/generate-readme.sh --check
# Install git hooks (run once after cloning)
install-hooks:
chmod +x scripts/hooks/pre-commit
ln -sf ../../scripts/hooks/pre-commit .git/hooks/pre-commit
@echo "Git hooks installed."
# ── Database (CockroachDB) ────────────────────────────────────────────────────
# Start CockroachDB
db-start:
{{ CONTAINER_RUNTIME }} compose -f {{ compose_file }} up -d
# Stop CockroachDB (preserves data)
db-stop:
{{ CONTAINER_RUNTIME }} compose -f {{ compose_file }} down
# Reset CockroachDB (removes all data)
db-reset:
{{ CONTAINER_RUNTIME }} compose -f {{ compose_file }} down -v
{{ CONTAINER_RUNTIME }} compose -f {{ compose_file }} up -d
# Check if CockroachDB is running
db-status:
@{{ CONTAINER_RUNTIME }} compose -f {{ compose_file }} ps 2>/dev/null || echo "CockroachDB is not running. Start it with: just db-start"
# Create the test database (idempotent)
db-setup:
@psql "postgresql://root@localhost:26257/defaultdb?sslmode=disable" \
-c "CREATE DATABASE IF NOT EXISTS tokf_test" 2>/dev/null \
&& echo "Database tokf_test is ready." \
|| echo "Could not connect to CockroachDB. Is it running? Try: just db-start"
# ── Integration & E2E tests ──────────────────────────────────────────────────
# Run tokf-server DB integration tests
test-db:
cargo test -p tokf-server -- --ignored
# Run end-to-end tests
test-e2e:
cargo test -p e2e-tests -- --ignored
# Run all tests: unit + DB integration + e2e
test-all: test test-db test-e2e