-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathjustfile
More file actions
132 lines (101 loc) · 3.24 KB
/
justfile
File metadata and controls
132 lines (101 loc) · 3.24 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
# Required for codex shell sessions where mise PATH hooks may not be active.
export PATH := env("HOME") + "/.local/share/mise/installs/zig/0.15.2/bin:" + env("PATH")
default:
just --list
build:
zig build -Doptimize=Debug
build-release:
zig build -Doptimize=ReleaseSmall
clean:
rm -rf tmp zig-out
mkdir tmp
run *ARGS:
zig build run -- {{ARGS}}
#
# dev
#
check: clean-weekly build lint test test-bats
just banner "✓ check ✓"
ci: check
just banner "✓ ci ✓"
clean-weekly:
if [ -d tmp ] && [ "$(find tmp -type d -prune -mtime +7 | wc -l)" -gt 0 ]; then \
just clean ; \
fi
fmt:
zig fmt src build.zig
just banner "✓ fmt ✓"
kcov: clean
just banner "kcov..."
zig build -Doptimize=Debug kcov-tests
kcov --include-pattern=$PWD/src/ --exclude-line=errdefer tmp/kcov ./zig-out/bin/kcov-tests
just banner "see tmp/kcov"
lint:
zig fmt --check src build.zig
bin/lint-args
bin/lint-imports
just banner "✓ lint ✓"
llm: fmt
LLM=1 just check
man: gen
man -l extra/tennis.1
readme:
glow --pager README.md
test:
if [ -n "${LLM:-}" ]; then zig build test --summary none ; else zig build test --summary all ; fi
just banner "✓ test ✓"
test-bats:
if [ -n "${LLM:-}" ]; then bats testdata/smoke.bats > /dev/null ; else bats testdata/smoke.bats ; fi
just banner "✓ test-bats ✓"
test-watch:
watchexec --clear=clear --stop-timeout=0 just test
valgrind: build
valgrind --quiet --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 \
./zig-out/bin/tennis --color=on -n --title foo testdata/test.csv > /dev/null
just banner "✓ valgrind ✓"
#
# benchmark - We intentionally benchmark `ReleaseSmall` because bin size matters
# more than peak throughput for this app.
#
benchmark: benchmark-csv benchmark-json
benchmark-csv: build-release
just banner "benchmark-csv"
bin/gen-benchmark-csv > tmp/tennis-benchmark.csv
BENCHMARK=1 ./zig-out/bin/tennis --width 80 tmp/tennis-benchmark.csv > /dev/null
benchmark-json: build-release
bin/gen-benchmark-json > tmp/tennis-benchmark.json
cat tmp/tennis-benchmark.json | sed '1d;$d;s/,$//' > tmp/tennis-benchmark.jsonl
just banner "benchmark-json"
BENCHMARK=1 ./zig-out/bin/tennis --width 80 tmp/tennis-benchmark.json > /dev/null
just banner "benchmark-jsonl"
BENCHMARK=1 ./zig-out/bin/tennis --width 80 tmp/tennis-benchmark.jsonl > /dev/null
#
# release and related items
#
gen:
just run --completion bash > extra/tennis.bash
just run --completion zsh > extra/_tennis
scdoc < extra/tennis.scd > extra/tennis.1
just banner "✓ gen ✓"
release: check valgrind
bin/release
release-preview: check
goreleaser release --clean --snapshot
just banner "macOS tarball preview..."
tar -tvzf "$(find tmp/dist -maxdepth 1 -name 'tennis_*_darwin_arm64.tar.gz' | head -n 1)"
[working-directory: 'tmp']
screenshot: build
../bin/screenshot
just banner "✓ screenshot - see tmp/vhs.png ✓"
#
# banner
#
set quiet
banner +ARGS: (_banner '\e[48;2;064;160;043m' ARGS)
warning +ARGS: (_banner '\e[48;2;251;100;011m' ARGS)
fatal +ARGS: (_banner '\e[48;2;210;015;057m' ARGS)
exit 1
_banner BG +ARGS:
if [ -z "${LLM:-}" ]; then \
printf '\e[38;5;231m{{BOLD+BG}}[%s] %-72s {{NORMAL}}\n' "$(date +%H:%M:%S)" "{{ARGS}}" ; \
fi