-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathjustfile
More file actions
170 lines (132 loc) · 5.28 KB
/
justfile
File metadata and controls
170 lines (132 loc) · 5.28 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
# Build configuration
cargo := "cargo"
binary := "ev-reth"
target_dir := "target"
# Docker configuration
git_tag := `git describe --tags --abbrev=0 2>/dev/null || echo "latest"`
git_commit := `git rev-parse --short HEAD 2>/dev/null || echo "unknown"`
docker_tag := env("DOCKER_TAG", git_commit)
bin_dir := "dist/bin"
docker_image := env("DOCKER_IMAGE_NAME", `echo "ghcr.io/$(git config --get remote.origin.url | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | cut -d'/' -f1)/ev-reth"`)
profile := env("PROFILE", "release")
features := env("FEATURES", "jemalloc")
# Default: list available recipes
default:
@just --list
# Building ─────────────────────────────────────────────
# Build the ev-reth binary in release mode
build:
{{cargo}} build --release --bin {{binary}}
# Build the ev-reth binary in debug mode
build-dev:
{{cargo}} build --bin {{binary}}
# Build ev-reth with the most aggressive optimizations
build-maxperf:
RUSTFLAGS="-C target-cpu=native" {{cargo}} build --profile maxperf --features jemalloc,asm-keccak --bin {{binary}}
# Build all workspace members
build-all:
{{cargo}} build --workspace --release
# Testing ──────────────────────────────────────────────
# Run all tests
test:
{{cargo}} test --workspace
# Run all tests with verbose output
test-verbose:
{{cargo}} test --workspace -- --nocapture
# Run unit tests only
test-unit:
{{cargo}} test --lib
# Run integration tests only
test-integration:
{{cargo}} test -p ev-tests
# Test only the node crate
test-node:
{{cargo}} test -p ev-node
# Test only the evolve crate
test-evolve:
{{cargo}} test -p evolve-ev-reth
# Test only the common crate
test-common:
{{cargo}} test -p ev-common
# Development ──────────────────────────────────────────
# Run the ev-reth node with default settings
run: build-dev
./{{target_dir}}/debug/{{binary}} node
# Run with debug logs enabled
run-dev: build-dev
RUST_LOG=debug ./{{target_dir}}/debug/{{binary}} node
# Build the ev-dev binary in release mode
build-ev-dev:
{{cargo}} build --release --bin ev-dev
# Build and run the local dev chain
dev-chain: build-ev-dev
./{{target_dir}}/release/ev-dev
# Format code using rustfmt (nightly)
fmt:
{{cargo}} +nightly fmt --all
# Check if code is formatted correctly (nightly)
fmt-check:
{{cargo}} +nightly fmt --all --check
# Run clippy linter
lint:
{{cargo}} clippy --all-targets --all-features -- -D warnings
# Run cargo check
check:
{{cargo}} check --workspace
# Run all checks (fmt, lint, test)
check-all: fmt-check lint test
# Maintenance ──────────────────────────────────────────
# Clean build artifacts
clean:
{{cargo}} clean
# Update dependencies
update:
{{cargo}} update
# Audit dependencies for security vulnerabilities
audit:
{{cargo}} audit
# Documentation ────────────────────────────────────────
# Build documentation
doc:
{{cargo}} doc --no-deps --open
# Build documentation including dependencies
doc-all:
{{cargo}} doc --open
# Docker ───────────────────────────────────────────────
# Build Docker image (tagged with git commit hash by default)
docker-build:
@echo "Building Docker image: {{docker_image}}:{{docker_tag}}"
docker build -t {{docker_image}}:{{docker_tag}} .
# Build and push a cross-arch Docker image
docker-build-push: _build-x86_64 _build-aarch64
mkdir -p {{bin_dir}}/linux/amd64
cp {{target_dir}}/x86_64-unknown-linux-gnu/{{profile}}/{{binary}} {{bin_dir}}/linux/amd64/{{binary}}
mkdir -p {{bin_dir}}/linux/arm64
cp {{target_dir}}/aarch64-unknown-linux-gnu/{{profile}}/{{binary}} {{bin_dir}}/linux/arm64/{{binary}}
docker buildx build --file ./Dockerfile.cross . \
--platform linux/amd64,linux/arm64 \
--tag {{docker_image}}:{{docker_tag}} \
--provenance=false \
--sbom=false \
--push
# Build and push a cross-arch Docker image tagged with latest
docker-build-push-latest: _build-x86_64 _build-aarch64
mkdir -p {{bin_dir}}/linux/amd64
cp {{target_dir}}/x86_64-unknown-linux-gnu/{{profile}}/{{binary}} {{bin_dir}}/linux/amd64/{{binary}}
mkdir -p {{bin_dir}}/linux/arm64
cp {{target_dir}}/aarch64-unknown-linux-gnu/{{profile}}/{{binary}} {{bin_dir}}/linux/arm64/{{binary}}
docker buildx build --file ./Dockerfile.cross . \
--platform linux/amd64,linux/arm64 \
--tag {{docker_image}}:{{git_tag}} \
--tag {{docker_image}}:latest \
--provenance=false \
--sbom=false \
--push
# Cross-compile for x86_64
[private]
_build-x86_64:
cross build --bin {{binary}} --target x86_64-unknown-linux-gnu --features "{{features}}" --profile "{{profile}}"
# Cross-compile for aarch64
[private]
_build-aarch64:
JEMALLOC_SYS_WITH_LG_PAGE=16 cross build --bin {{binary}} --target aarch64-unknown-linux-gnu --features "{{features}}" --profile "{{profile}}"