-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
145 lines (107 loc) · 3.6 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
# Load environment variables from `.env` file.
# show available just recipes
_default:
@just --list --justfile {{ justfile() }}
audit:
cargo audit
# build debug executable
build:
cargo build
build-sqlite3-rs:
cargo build --bin sqlite-rs
build-logtopbind:
cargo build --bin logtopbind
check:
cargo check
clean:
cargo clean
# show dependencies of this project
deps:
cargo tree
# generate the documentation of this project
docs:
cargo doc --open
# format source code
format:
cargo +nightly fmt
# evaluate and print all just variables
just-vars:
@just --evaluate
# linters (requires https://github.com/rust-lang/rust-clippy)
lint:
# Default clippy settings (used by `cargo [build, test]` automatically):
#
# cargo clippy
#
# If you want stricter clippy settings, start with the suggestion below
# and consider adding this `lint` target as a dependency to other just
# targets like `build` and `test`.
#
# --all-targets: check sources and tests
# --all-features: check non-default crate features
# -D warnings: fail the build when encountering warnings
#
cargo clippy --verbose --all-targets --all-features -- -D warnings
# detect outdated crates (requires https://github.com/kbknapp/cargo-outdated)
outdated:
cargo outdated
pre-release: check test lint
# build release executable
release: pre-release
cargo build --release
queries-db-remove:
/bin/rm -rf queries.db queries.db-journal
# build and run
run-logtopbind-simple: build-logtopbind queries-db-remove
./target/debug/logtopbind ./testdata/log_top.q
run-logtopbind-500k: build-logtopbind queries-db-remove
./target/debug/logtopbind ./testdata/log_top_500k.q
run-logtopbind-50m: build-logtopbind queries-db-remove
./target/debug/logtopbind ./testdata/log_top_50m.q
# build and run
run-logtopbind-release-simple: queries-db-remove
cargo run --release --bin logtopbind ./testdata/log_top.q
run-logtopbind-release-500k: queries-db-remove
cargo run --release --bin logtopbind ./testdata/log_top_500k.q
run-logtopbind-release-50m: build-logtopbind queries-db-remove
cargo run --release --bin logtopbind ./testdata/log_top_50m.q
test: test-deleted-entries
cargo test
sqlite3:
sqlite3 queries.db 'select * from logs;'
sqlite3-json:
sqlite3 queries.db "select bind_statements -> '$[0]' from logs;"
error-clip:
cargo check |& clip
sqlite3-rs-select: build-sqlite3-rs
./target/debug/sqlite-rs queries.db 'select * from logs;'
sqlite3-rs-select-replaced-1: build-sqlite3-rs
./target/debug/sqlite-rs queries.db 'select replaced_query from logs limit 1;'
sqlite3-rs-interactive: build-sqlite3-rs
./target/debug/sqlite-rs queries.db
build-logtopprint:
cargo build --bin logtopprint
query-print-3: build-logtopprint
./target/debug/logtopprint --query-no 3
# print system information such as OS and architecture
system-info:
@echo "architecture: {{ arch() }}"
@echo "os: {{ os() }}"
@echo "os family: {{ os_family() }}"
release-patch: test
cargo release patch --no-publish
compare:
just check-question-0-1-2
just check-question-debug
check-question-0-1-2:
rm queries.db
./logtopbind-0.1.2 ./testdata/log_top_50m.q
sqlite3 queries.db 'select id, query_no, replaced_query from logs;' | rg '\?' > 0.1.2.log
check-question-debug:
rm queries.db
./target/debug/logtopbind ./testdata/log_top_50m.q
sqlite3 queries.db 'select id, query_no, replaced_query from logs;' | rg '\?' > develop.log
test-big:
cargo test test_big_line -- --nocapture
test-deleted-entries:
./tests/test_deleted_entries.sh