-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
90 lines (71 loc) · 2.13 KB
/
Justfile
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
_help:
@just --list --unsorted
# lint, build, install and tape
all: audit (install '~/.aud/bin') tape
# format, lint and check deps - requires `cargo-deny`
audit:
cargo fmt --all --check
cargo clippy -- -D warnings -D clippy::all
cargo update --dry-run
cargo deny check bans advisories
# build in release - requires `cargo-limit`
build:
cargo lbuild --release
# run in release - requires `cargo-limit`
run CMD:
cargo lrun --release -- {{CMD}}
# run all tests - requires `cargo-nextest`
test:
cargo nextest run --all-targets --all-features -j{{num_cpus()}}
cargo test --doc
# run a command every time source files change - requires `cargo-watch`
dev CMD='just b':
cargo watch -cs 'reset; {{CMD}}' -i 'vhs/*' -i 'out/*' -i 'lua/api/examples/*'
# run the benchmarks
bench:
cargo bench --features bench
# clean-build a release build with a timing report
buildtime:
cargo clean && cargo build --timings --verbose --release
# install the apps in a directory
install DIR='./out': build
#!/usr/bin/env bash
mkdir -p {{DIR}}
cp target/release/aud {{DIR}}/aud
_tape CMD:
vhs vhs/{{CMD}}.tape
# create CLI recordings - requires `vhs` & `parallel`
tape:
#!/usr/bin/env bash
parallel --ungroup vhs ::: vhs/*
# tail a log file - request `bat`
log FILE='./out/aud.log':
# log highlighting is available but yaml looks nicer
tail -n5 -f {{FILE}} | bat --paging=never -l=yaml --style=plain
# log localhost udp comms
udpdump:
sudo tcpdump -i lo0 udp port 8080 -v # -X
# profile aud CLI - requires `cargo-flamegraph`
profile ARGS:
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --bin aud -- {{ARGS}}
# run-once setup your development environment for this project
setup: (_setup_packages)
cargo install cargo-deny cargo-watch cargo-nextest bat
echo "#!/bin/sh\n\n"\
"just audit\n"\
> .git/hooks/pre-push
chmod +x .git/hooks/pre-push
# check for unused dependencies - requires cargo-udeps
_udeps:
cargo +nightly udeps
[linux]
_setup_packages:
sudo apt-get install parallel vhs pkg-config lua
[macos]
_setup_packages:
brew install parallel vhs pkg-config lua
alias t := test
alias i := install
alias b := build
alias d := dev
alias r := run