forked from midnightntwrk/midnight-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
143 lines (119 loc) · 5.68 KB
/
justfile
File metadata and controls
143 lines (119 loc) · 5.68 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
set shell := ["bash", "-uc"]
# Can be overridden on the command line: `just feature=standalone`.
feature := "cloud"
packages := "indexer-common chain-indexer wallet-indexer indexer-api indexer-standalone indexer-tests"
rust_version := `grep channel rust-toolchain.toml | sed -r 's/channel = "(.*)"/\1/'`
nightly := "nightly-2025-09-19"
node_version := `cat NODE_VERSION`
check:
for package in {{packages}}; do \
cargo check -p "$package" --tests; \
cargo check -p "$package" --tests --features {{feature}}; \
done
license-headers:
./license_headers.sh
fmt:
cargo +{{nightly}} fmt
fmt-check:
cargo +{{nightly}} fmt --check
fix:
cargo fix --allow-dirty --allow-staged --features {{feature}} --tests
lint:
for package in {{packages}}; do \
cargo clippy -p "$package" --no-deps --tests -- -D warnings; \
cargo clippy -p "$package" --no-deps --tests --features {{feature}} -- -D warnings; \
done
lint-fix:
for package in {{packages}}; do \
cargo clippy -p "$package" --no-deps --tests --fix --allow-dirty --allow-staged ; \
cargo clippy -p "$package" --no-deps --tests --fix --allow-dirty --allow-staged --features {{feature}}; \
done
test:
# We must build the executables needed by the e2e tests!
if [ "{{feature}}" = "cloud" ]; then \
cargo build -p chain-indexer -p wallet-indexer -p indexer-api --features cloud; \
fi
if [ "{{feature}}" = "standalone" ]; then \
cargo build -p indexer-standalone --features standalone; \
fi
cargo nextest run --workspace --exclude indexer-standalone --features {{feature}}
# Check indexer-api schema:
cargo run -p indexer-api --bin indexer-api-cli print-api-schema-v3 > \
indexer-api/graphql/schema-v3.graphql.check
@if ! cmp -s indexer-api/graphql/schema-v3.graphql indexer-api/graphql/schema-v3.graphql.check; then \
echo "schema-v3.graphql has changes!"; exit 1; \
fi
doc:
RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +{{nightly}} doc -p indexer-common --no-deps --all-features
RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +{{nightly}} doc -p chain-indexer --no-deps --features {{feature}}
RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +{{nightly}} doc -p wallet-indexer --no-deps --features {{feature}}
RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +{{nightly}} doc -p indexer-api --no-deps --features {{feature}}
if [ "{{feature}}" = "standalone" ]; then \
RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +{{nightly}} doc -p indexer-standalone --no-deps --features standalone; \
fi
all: license-headers check fmt lint test doc
all-all:
just feature=cloud all
just feature=standalone all
coverage:
./coverage.sh {{nightly}}
generate-indexer-api-schema:
cargo run -p indexer-api --bin indexer-api-cli print-api-schema-v3 > \
indexer-api/graphql/schema-v3.graphql
build-docker-image package profile="dev":
tag=$(git rev-parse --short=8 HEAD) && \
docker build \
--build-arg "RUST_VERSION={{rust_version}}" \
--build-arg "PROFILE={{profile}}" \
-t ghcr.io/midnight-ntwrk/{{package}}:${tag} \
-t ghcr.io/midnight-ntwrk/{{package}}:latest \
-f {{package}}/Dockerfile \
.
run-chain-indexer node="ws://localhost:9944" network_id="undeployed":
docker compose up -d --wait postgres nats
RUST_LOG=chain_indexer=debug,indexer_common=debug,fastrace_opentelemetry=off,tracing::span=off,midnight_ledger=warn,info \
CONFIG_FILE=chain-indexer/config.yaml \
APP__APPLICATION__NETWORK_ID={{network_id}} \
APP__INFRA__NODE__URL={{node}} \
cargo run -p chain-indexer --features {{feature}}
run-wallet-indexer network_id="undeployed":
docker compose up -d --wait postgres nats
RUST_LOG=wallet_indexer=debug,indexer_common=debug,fastrace_opentelemetry=off,info \
CONFIG_FILE=wallet-indexer/config.yaml \
APP__APPLICATION__NETWORK_ID={{network_id}} \
cargo run -p wallet-indexer --features {{feature}}
run-indexer-api network_id="undeployed":
docker compose up -d --wait postgres nats
RUST_LOG=indexer_api=debug,indexer_common=debug,info \
CONFIG_FILE=indexer-api/config.yaml \
APP__APPLICATION__NETWORK_ID={{network_id}} \
cargo run -p indexer-api --bin indexer-api --features {{feature}}
run-indexer-standalone node="ws://localhost:9944" network_id="undeployed":
mkdir -p target/data
RUST_LOG=indexer=debug,chain_indexer=debug,wallet_indexer=debug,indexer_api=debug,indexer_common=debug,fastrace_opentelemetry=off,info \
CONFIG_FILE=indexer-standalone/config.yaml \
APP__APPLICATION__NETWORK_ID={{network_id}} \
APP__INFRA__NODE__URL={{node}} \
APP__INFRA__STORAGE__CNN_URL=target/data/indexer.sqlite \
cargo run -p indexer-standalone --features standalone
update-node: generate-node-data get-node-metadata
generate-node-data:
./generate_node_data.sh {{node_version}}
get-node-metadata:
./get_node_metadata.sh {{node_version}}
generate-txs:
./generate_txs.sh {{node_version}}
run-node:
#!/usr/bin/env bash
node_dir=$(mktemp -d)
cp -r ./.node/{{node_version}}/ $node_dir
# SIDECHAIN_BLOCK_BENEFICIARY specifies the wallet that receives block rewards and transaction fees (DUST).
# This hex value is a public key that matches the one used in toolkit-e2e.sh.
docker run \
--name node \
-p 9944:9944 \
-e SHOW_CONFIG=false \
-e CFG_PRESET=dev \
-e SIDECHAIN_BLOCK_BENEFICIARY="04bcf7ad3be7a5c790460be82a713af570f22e0f801f6659ab8e84a52be6969e" \
-v $node_dir:/node \
ghcr.io/midnight-ntwrk/midnight-node:{{node_version}}