forked from picodata/picodata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.justfile
195 lines (163 loc) · 4.48 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#****************#
# settings: GLOB #
#****************#
set quiet
[private]
default:
{{ JUST_EXEC }} --list --unsorted --no-aliases
#***************#
# settings: ENV #
#***************#
JUST_EXEC := just_executable()
PYTEST_JOBS := "--numprocesses=auto"
CARGO_FLAGS_EXTRA := env("CARGO_FLAGS_EXTRA", "")
CARGO_FLAGS := "--features webui"
CARGO_PROFILE := env("CARGO_PROFILE", "")
CARGO_ENV := env("CARGO_ENV", "")
LOCKED := "--locked"
LOG_WARN := "PICODATA_LOG_LEVEL=warn"
#**************#
# group: BUILD #
#**************#
alias b := build
[group("build")]
[doc("`b`: build project")]
build *ARGS:
if test -f ~/.cargo/env; then . ~/.cargo/env; fi && {{ CARGO_ENV }} \
cargo build {{ LOCKED }} {{ ARGS }} {{ CARGO_PROFILE }} {{ CARGO_FLAGS }} {{ CARGO_FLAGS_EXTRA }}
alias bd := build-dev
[group("build")]
[doc("`bd`: development profile")]
build-dev *ARGS:
{{ JUST_EXEC }} build {{ ARGS }} --profile=dev
alias br := build-release
[group("build")]
[doc("`br`: release profile")]
build-release *ARGS:
{{ JUST_EXEC }} build {{ ARGS }} --profile=release
alias bw := build-webui
[group("build")]
[doc("`bw`: webui bundle")]
build-webui:
yarn --cwd webui install \
--prefer-offline \
--frozen-lockfile \
--no-progress \
--non-interactive
yarn --cwd webui vite build \
--outDir dist \
--emptyOutDir
#*************#
# group: TEST #
#*************#
alias t := test
[group("test")]
[doc("`t`: integration and unit tests")]
test *ARGS:
{{ JUST_EXEC }} test-rust {{ ARGS }}
{{ JUST_EXEC }} test-python
alias tr := test-rust
[group("test")]
[doc("`tr`: rust tests")]
test-rust *ARGS:
cargo test {{ LOCKED }} {{ ARGS }} {{ CARGO_PROFILE }}
alias tp := test-python
[group("test")]
[doc("`tp`: python tests")]
test-python:
poetry run pytest {{ PYTEST_JOBS }}
#*************#
# group: LINT #
#*************#
alias l := lint
[group("lint")]
[doc("`l`: checks and lints")]
lint *ARGS:
{{ JUST_EXEC }} lint-rust {{ ARGS }}
{{ JUST_EXEC }} lint-python
alias lr := lint-rust
[group("lint")]
[doc("`lr`: rust lints")]
lint-rust *ARGS:
cargo fmt --check
cargo check {{ LOCKED }} {{ ARGS }}
cargo clippy --version
cargo clippy {{ LOCKED }} {{ ARGS }} {{ CARGO_FLAGS }} \
--features=load_test,error_injection -- --deny clippy::all --no-deps
RUSTDOCFLAGS="-Dwarnings -Arustdoc::private_intra_doc_links" \
cargo doc {{ LOCKED }} {{ ARGS }} \
--workspace --no-deps --document-private-items \
--exclude=tlua --exclude=sbroad-core --exclude=tarantool
alias lp := lint-python
[group("lint")]
[doc("`lp`: python lints")]
lint-python:
poetry run flake8 ./test
poetry run black ./test --check --diff
poetry run mypy ./test
#************#
# group: FMT #
#************#
alias f := fmt
[group("fmt")]
[doc("`f`: format the code")]
fmt:
{{ JUST_EXEC }} fmt-rust
{{ JUST_EXEC }} fmt-python
alias fr := fmt-rust
[group("fmt")]
[doc("`fr`: rust format")]
fmt-rust:
cargo fmt
alias fp := fmt-python
[group("fmt")]
[doc("`fp`: python format")]
fmt-python:
poetry run black ./test
#**************#
# group: STATS #
#**************#
alias sf := flamegraph
[group("stats")]
[doc("`sf`: flamegraph for benchmark recipe")]
flamegraph:
{{ LOG_WARN }} poetry run pytest test/manual/test_benchmark.py --with-flamegraph
alias sb := benchmark
[group("stats")]
[doc("`sb`: integration sql benchmarks")]
benchmark:
{{ LOG_WARN }} poetry run pytest test/manual/test_benchmark.py
alias sk := k6
[group("stats")]
[doc("`sk`: sql benchmarks with k6")]
k6:
{{ LOG_WARN }} poetry run pytest test/manual/sql/test_sql_perf.py
#*************#
# group: MISC #
#*************#
[group("misc")]
[doc("remove cargo and python cache, clean submodules")]
[confirm("Do you really want to clear all cache and submodules? (y/n)")]
clean:
cargo clean || true
git submodule foreach --recursive 'git clean -dxf && git reset --hard'
find . -type d -name __pycache__ | xargs -n 500 rm -rf
[group("misc")]
[doc("install binaries and documentation to DEST")]
install DEST:
mkdir -p {{ DEST }}/usr/bin
install -m 0755 target/*/picodata {{ DEST }}/usr/bin/picodata
[group("misc")]
[doc("install appropriate rust toolchain version")]
toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |\
sh -s -- -y --profile default --default-toolchain 1.76.0
[group("misc")]
[doc("reset git submodules to initial state and update")]
reset-submodules:
git submodule foreach --recursive 'git clean -dxf && git reset --hard'
git submodule update --init --recursive
[group("misc")]
[doc("patch tarantool version")]
tarantool-patch:
@echo "${VER_TNT}" > tarantool-sys/VERSION