-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
121 lines (94 loc) · 4.12 KB
/
justfile
File metadata and controls
121 lines (94 loc) · 4.12 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
# A3S Gateway - Justfile
default:
@just --list
# ============================================================================
# Build
# ============================================================================
# Debug build
build:
cargo build
# Optimised release build (LTO + strip — matches CI profile)
release:
cargo build --release
# Build with all optional features (redis, kube)
build-all:
cargo build --all-features
# ============================================================================
# Test
# ============================================================================
# Run all unit tests with a clean summary
test:
#!/usr/bin/env bash
set -euo pipefail
BOLD='\033[1m'; GREEN='\033[0;32m'; RED='\033[0;31m'
YELLOW='\033[0;33m'; DIM='\033[2m'; RESET='\033[0m'
echo ""
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e "${BOLD} A3S Gateway — Test Suite${RESET}"
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""
output=$(cargo test --lib 2>&1)
echo "$output"
result=$(echo "$output" | grep -E "^test result:" | tail -1)
passed=$(echo "$result" | grep -oE '[0-9]+ passed' | grep -oE '[0-9]+' || echo 0)
failed=$(echo "$result" | grep -oE '[0-9]+ failed' | grep -oE '[0-9]+' || echo 0)
ignored=$(echo "$result" | grep -oE '[0-9]+ ignored' | grep -oE '[0-9]+' || echo 0)
echo ""
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
if [ "$failed" -gt 0 ]; then
echo -e " ${RED}${BOLD}✗ FAILED${RESET} ${GREEN}$passed passed${RESET} ${RED}$failed failed${RESET} ${YELLOW}$ignored ignored${RESET}"
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""
exit 1
else
echo -e " ${GREEN}${BOLD}✓ PASSED${RESET} ${GREEN}$passed passed${RESET} ${YELLOW}$ignored ignored${RESET}"
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
fi
echo ""
# Run tests with all optional features
test-all:
cargo test --all-features --lib
# Run a specific test by name
test-one TEST:
cargo test {{TEST}} -- --nocapture
# Run tests for a specific module (e.g. `just test-mod proxy::acme_dns`)
test-mod MOD:
cargo test --lib -- {{MOD}}
# ============================================================================
# Code Quality
# ============================================================================
# Format code
fmt:
cargo fmt --all
# Check formatting (non-destructive)
fmt-check:
cargo fmt --all -- --check
# Lint (clippy)
lint:
cargo clippy --all-targets -- -D warnings
# Lint with all features
lint-all:
cargo clippy --all-features --all-targets -- -D warnings
# Full CI gate (fmt + lint + test) — must pass before tagging a release
ci: fmt-check lint test
# ============================================================================
# Versioning
# ============================================================================
# Show current version
version:
@grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/'
# ============================================================================
# Utilities
# ============================================================================
# Fast compile check (no codegen)
check:
cargo check --all-features
# Clean build artefacts
clean:
cargo clean
# Generate and open docs
doc:
cargo doc --no-deps --open
# Update all dependencies
update:
cargo update