-
Notifications
You must be signed in to change notification settings - Fork 1
/
justfile
150 lines (112 loc) · 4.87 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
# === Config ===
integration_test_dir := justfile_directory() / ".scratch/integration_tests"
integration_test_base_url := "https://tycho-test.broxus.cc"
local_network_dir := justfile_directory() / ".temp"
# === Simple commands ===
default:
@just --choose
# Installs the required version of `rustfmt`.
install_fmt:
rustup component add rustfmt --toolchain nightly
# Installs the required version of links checker. See https://github.com/lycheeverse/lychee.
install_lychee:
cargo install lychee
# Creates venv and installs all required script dependencies.
install_python_deps:
./scripts/install-python-deps.sh
# Formats the whole project.
fmt: install_fmt
cargo +nightly fmt --all
# CI checks.
ci: check_dev_docs check_format lint test
# Checks links in the `/docs` directory.
check_dev_docs:
lychee {{ justfile_directory() }}/docs
# Checks whether the code is formatted.
check_format: install_fmt
cargo +nightly fmt --all -- --check
# Clippy go brr.
lint:
#cargo clippy --all-targets --all-features --workspace # update when clippy is fixed
cargo clippy --all-targets --all-features -p tycho-block-util -p tycho-core -p tycho-network -p tycho-rpc -p tycho-storage -p tycho-consensus -p tycho-util -p tycho-collator -p tycho-control -p tycho-light-node -p tycho-cli -- -D warnings
# Generates cargo docs.
docs:
export RUSTDOCFLAGS=-D warnings
cargo doc --no-deps --document-private-items --all-features --workspace
# Runs all tests.
test:
cargo nextest run -p tycho-block-util -p tycho-core -p tycho-network -p tycho-rpc -p tycho-storage -p tycho-consensus -p tycho-util -p tycho-collator -p tycho-control
test_cov:
#!/usr/bin/env bash
set -euo pipefail
export RUSTC_WRAPPER=scripts/coverage.py
export RUST_LOG=warn
if [ -n "${CI:-}" ]; then
# Running in GitHub Actions
cargo llvm-cov nextest --codecov --output-path codecov.json -p tycho-block-util -p tycho-core -p tycho-network -p tycho-rpc -p tycho-storage -p tycho-consensus -p tycho-util -p tycho-collator -p tycho-control -p tycho-cli
else
# Running locally
cargo llvm-cov nextest --open -p tycho-block-util -p tycho-core -p tycho-network -p tycho-rpc -p tycho-storage -p tycho-consensus -p tycho-util -p tycho-collator -p tycho-control -p tycho-cli
fi
check_dashboard:
/usr/bin/env python ./scripts/check-metrics.py
# Generates a Grafana panel JSON.
gen_dashboard:
#!/usr/bin/env bash
if ! [ -d ".venv" ]; then
./scripts/install-python-deps.sh
fi
/usr/bin/env python ./scripts/gen-dashboard.py
update_rpc_proto:
cargo run -p tycho-gen-protos
# === Integration tests stuff ===
# Runs all tests including ignored. Will take a lot of time to run.
run_integration_tests: prepare_integration_tests
./scripts/run-integration-tests.sh
# Synchronizes files for integration tests.
prepare_integration_tests:
./scripts/prepare-integration-tests.sh \
--dir {{ integration_test_dir }} \
--base-url {{ integration_test_base_url }}
# Removes all files for integration tests.
clean_integration_tests:
rm -rf {{ integration_test_dir }}
# === Local network stuff ===
# Builds the node and prints a path to the binary. Use `TYCHO_BUILD_PROFILE` env to explicitly set cargo profile.
build *flags:
./scripts/build-node.sh {{ flags }}
# Creates a node config template with all defaults. Use `--force` to overwrite.
init_node_config *flags:
./scripts/init-node-config.sh {{ flags }}
# Creates a zerostate config template with all defaults. Use `--force` to overwrite.
init_zerostate_config *flags:
./scripts/init-zerostate-config.sh {{ flags }}
# Creates a network of `N` nodes. Use `--force` to reset the state.
gen_network *flags:
./scripts/gen-network.sh --dir {{ local_network_dir }} {{ flags }}
# Runs the node `N`.
# Use `--mempool-start-round {round_id} --from-mc-block-seqno {seqno}`
# to define last applied mc block and processed to anchor id.
node *flags:
./scripts/run-node.sh --dir {{ local_network_dir }} {{ flags }}
# Participates in elections from the node `N`.
elect *flags:
./scripts/elect-node.sh --dir {{ local_network_dir }} {{ flags }}
# Runs only mempool part of the node `N`.
# Use `--mempool-start-round {round_id}`
# to define new mempool genesis at non-default round
mempool *flags:
./scripts/run-mempool.sh --dir {{ local_network_dir }} {{ flags }}
# Dumps necessary part 01 of test data from the local running network:
# zerostate, initial state of shard 0:80,
# first empty master block and it's queue diff
dump_test_data_01:
./scripts/dump-test-data-01.sh
# Dumps necessary part 02 of test data from the local running network under load:
# not empty block from shard 0:80
dump_test_data_02:
./scripts/dump-test-data-02.sh
# Dumps necessary part 03 of test data from the local running network under load:
# first 3 archives
dump_test_data_03:
./scripts/dump-test-data-03.sh