-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathjustfile
More file actions
172 lines (134 loc) · 5 KB
/
justfile
File metadata and controls
172 lines (134 loc) · 5 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
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
_default:
@just --list
# Checks whether a command is available.
check-command cmd recipe="check-command" link_to_package="":
@if ! command -v "{{ cmd }}" >/dev/null; then \
echo "Command '{{ cmd }}' is not available, but 'just {{ recipe }}' requires it." >&2; \
if [ -n "{{ link_to_package }}" ]; then \
echo "This might help you: {{ link_to_package }}" >&2; \
fi; \
exit 1; \
fi
# Run Florestad locally
run:
cargo run --bin florestad
# Runs Florestad locally with release options
run-release:
cargo run --release --bin florestad
# Compile project with debug options
build:
cargo build
# Compile project with release options
build-release:
cargo build --release
# Clean project build directory
clean:
cargo clean
# Execute all tests
test crate="":
@just test-doc {{ crate }}
@just test-unit {{ crate }}
@just test-wkspc
# Execute doc tests
test-doc crate="": build
cargo test {{ crate }} --doc
# Execute unit tests
test-unit crate="": build
cargo test --lib {{ crate }} -- --nocapture
# Execute workspace-related tests
test-wkspc: build
cargo test --workspace -- --nocapture
# Execute tests/prepare.sh.
test-functional-prepare arg="":
bash tests/prepare.sh {{ arg }}
# Execute tests/run.sh
test-functional-run arg="":
bash tests/run.sh {{ arg }}
# Format and lint functional tests
test-functional-uv-fmt:
@just check-command uv test-functional-uv-fmt "https://docs.astral.sh/uv/getting-started/installation/"
uv run black --verbose ./tests
uv run pylint --verbose ./tests
# Run the functional tests
test-functional:
@just test-functional-prepare
@just test-functional-run
# Run the benchmarks
bench:
cargo bench -p floresta-chain --no-default-features --features test-utils,flat-chainstore
# Generate the public documentation for all crates
doc:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --workspace --no-deps --lib --all-features --exclude metrics
# Generate and open the public documentation for all crates
open-doc:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --workspace --no-deps --all-features --lib --open --exclude metrics
# Generate the documentation for all crates, including private items, and fail on warnings
doc-check:
RUSTDOCFLAGS="--cfg docsrs -D warnings" \
cargo +nightly doc --workspace --no-deps --all-features --lib --document-private-items --exclude metrics
# Format code and run configured linters
lint:
@just fmt
@just doc-check
# 1) Run with no features
cargo +nightly clippy --workspace --all-targets --no-default-features
# 2) Run with all features
cargo +nightly clippy --workspace --all-targets --all-features
@just spell-check
# Lint the functional tests
@just test-functional-uv-fmt
# Format code
fmt:
cargo +nightly fmt --all
# Checks the formatting
format:
cargo +nightly fmt --all --check
# Test all feature combinations in each crate (arg: optional, e.g., --quiet or --verbose)
test-features arg="":
@just check-command "cargo-hack" "test-features" "cargo install cargo-hack --locked --version 0.6.34"
./contrib/feature_matrix.sh test {{ arg }}
# Format code and run clippy for all feature combinations in each crate (arg: optional, e.g., '-- -D warnings')
lint-features arg="":
@just check-command "cargo-hack" "lint-features" "cargo install cargo-hack --locked --version 0.6.34"
@just fmt
@just doc-check
@just spell-check
./contrib/feature_matrix.sh clippy '{{ arg }}'
@just test-functional-uv-fmt
# Remove test-generated data
clean-data:
./contrib/clean_data.sh
# Run all needed checks before contributing code (pre-commit check)
pcc:
@just check-command "cargo-hack" "pcc" "cargo install cargo-hack --locked --version 0.6.34"
just lint-features '-- -D warnings'
just test-features
just test-functional
# Must have pandoc installed
# Needs sudo to overwrite existing man pages
# Convert all markdown files on /doc/rpc/ to man pages on /doc/rpc_man/
gen-manpages path="":
@just check-command pandoc gen-manpages "https://pandoc.org/installing.html"
./contrib/dist/gen_manpages.sh {{ path }}
# Run typos
spell-check:
@just check-command typos spell-check "cargo +nightly install typos-cli --locked"
typos
# Usage:
# just install # installs both florestad and floresta-cli
# just install florestad # installs only florestad
# just install floresta-cli # installs only floresta-cli
#
# Floresta recipe to help installing the binaries without versioning problems.
install bin="all":
if [ "{{ bin }}" = "all" ]; then \
cargo install --path bin/florestad --locked && \
cargo install --path bin/floresta-cli --locked; \
elif [ "{{ bin }}" = "florestad" ]; then \
cargo install --path bin/florestad --locked; \
elif [ "{{ bin }}" = "floresta-cli" ]; then \
cargo install --path bin/floresta-cli --locked; \
else \
printf "Unknown binary: %s\n" "{{ bin }}" >&2; \
exit 1; \
fi