Skip to content

Commit ffd24a5

Browse files
tac0turtleclaude
andcommitted
build: split justfile into per-group files under .just/
Root justfile now holds variables and imports. Recipe files: build, test, proto, lint, codegen, run, tools. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 149b405 commit ffd24a5

8 files changed

Lines changed: 335 additions & 349 deletions

File tree

.just/build.just

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Build Testapp CLI
2+
[group('build')]
3+
build:
4+
@echo "--> Building Testapp CLI"
5+
@mkdir -p {{ build_dir }}
6+
@cd apps/testapp && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/testapp .
7+
@echo "--> Testapp CLI Built!"
8+
@echo " Check the version with: build/testapp version"
9+
@echo " Check the binary with: {{ build_dir }}/testapp"
10+
11+
# Install Testapp CLI to Go bin directory
12+
[group('build')]
13+
install:
14+
@echo "--> Installing Testapp CLI"
15+
@cd apps/testapp && go install -ldflags "{{ ldflags }}" .
16+
@echo "--> Testapp CLI Installed!"
17+
@echo " Check the version with: testapp version"
18+
@echo " Check the binary with: which testapp"
19+
20+
# Build all ev-node binaries
21+
[group('build')]
22+
build-all:
23+
@echo "--> Building all ev-node binaries"
24+
@mkdir -p {{ build_dir }}
25+
@echo "--> Building testapp"
26+
@cd apps/testapp && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/testapp .
27+
@echo "--> Building evm"
28+
@cd apps/evm && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/evm .
29+
@echo "--> Building local-da"
30+
@cd tools/local-da && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/local-da .
31+
@echo "--> All ev-node binaries built!"
32+
33+
# Build Testapp Bench
34+
[group('build')]
35+
build-testapp-bench:
36+
@echo "--> Building Testapp Bench"
37+
@mkdir -p {{ build_dir }}
38+
@cd apps/testapp && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/testapp-bench ./kv/bench
39+
@echo " Check the binary with: {{ build_dir }}/testapp-bench"
40+
41+
# Build EVM binary
42+
[group('build')]
43+
build-evm:
44+
@echo "--> Building EVM"
45+
@mkdir -p {{ build_dir }}
46+
@cd apps/evm && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/evm .
47+
@echo " Check the binary with: {{ build_dir }}/evm"
48+
49+
# Build local-da binary
50+
[group('build')]
51+
build-da:
52+
@echo "--> Building local-da"
53+
@mkdir -p {{ build_dir }}
54+
@cd tools/local-da && go build -ldflags "{{ ldflags }}" -o {{ build_dir }}/local-da .
55+
@echo " Check the binary with: {{ build_dir }}/local-da"
56+
57+
# Build Docker image for local testing
58+
[group('build')]
59+
docker-build:
60+
@echo "--> Building Docker image for local testing"
61+
@docker build -t evstack:local-dev -f apps/testapp/Dockerfile .
62+
@echo "--> Docker image built: evstack:local-dev"
63+
@echo "--> Checking if image exists locally..."
64+
@docker images evstack:local-dev
65+
66+
# Clean build artifacts
67+
[group('build')]
68+
clean:
69+
@echo "--> Cleaning build directory"
70+
@rm -rf {{ build_dir }}
71+
@echo "--> Build directory cleaned!"

.just/codegen.just

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generate mocks
2+
[group('codegen')]
3+
mock-gen:
4+
@echo "-> Generating mocks"
5+
go run github.com/vektra/mockery/v3@latest
6+
7+
# Install dependencies and tidy all modules
8+
[group('codegen')]
9+
deps:
10+
@echo "--> Installing dependencies"
11+
@go mod download
12+
@go mod tidy
13+
@go run scripts/tidy.go
14+
15+
# Tidy all go.mod files
16+
[group('codegen')]
17+
tidy-all:
18+
@go run -tags=tidy scripts/tidy.go

.just/lint.just

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Run all linters
2+
[group('lint')]
3+
lint: vet
4+
@echo "--> Running golangci-lint"
5+
@golangci-lint run
6+
@echo "--> Running markdownlint"
7+
@markdownlint --config .markdownlint.yaml '**/*.md'
8+
@echo "--> Running hadolint"
9+
@hadolint test/docker/mockserv.Dockerfile
10+
@echo "--> Running yamllint"
11+
@yamllint --no-warnings . -c .yamllint.yml
12+
@echo "--> Running goreleaser check"
13+
@goreleaser check
14+
@echo "--> Running actionlint"
15+
@actionlint
16+
17+
# Auto-fix linting issues
18+
[group('lint')]
19+
lint-fix:
20+
@echo "--> Formatting go"
21+
@golangci-lint run --fix
22+
@echo "--> Formatting markdownlint"
23+
@markdownlint --config .markdownlint.yaml --ignore './changelog.md' '**/*.md' -f
24+
25+
# Run go vet
26+
[group('lint')]
27+
vet:
28+
@echo "--> Running go vet"
29+
@go vet ./...

.just/proto.just

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generate protobuf files
2+
[group('proto')]
3+
proto-gen:
4+
@echo "--> Generating Protobuf files"
5+
buf generate --path="./proto/evnode" --template="buf.gen.yaml" --config="buf.yaml"
6+
buf generate --path="./proto/execution/evm" --template="buf.gen.evm.yaml" --config="buf.yaml"
7+
8+
# Lint protobuf files (requires Docker)
9+
[group('proto')]
10+
proto-lint:
11+
@echo "--> Linting Protobuf files"
12+
@docker run --rm -v {{ justfile_directory() }}:/workspace --workdir /workspace bufbuild/buf:latest lint --error-format=json
13+
14+
# Generate Rust protobuf files
15+
[group('proto')]
16+
rust-proto-gen:
17+
@echo "--> Generating Rust protobuf files"
18+
@cd client/crates/types && EV_TYPES_FORCE_PROTO_GEN=1 cargo build
19+
20+
# Check if Rust protobuf files are up to date
21+
[group('proto')]
22+
rust-proto-check:
23+
@echo "--> Checking Rust protobuf files"
24+
@rm -rf client/crates/types/src/proto/*.rs
25+
@cd client/crates/types && cargo build
26+
@if ! git diff --exit-code client/crates/types/src/proto/; then \
27+
echo "Error: Generated Rust proto files are not up to date."; \
28+
echo "Run 'just rust-proto-gen' and commit the changes."; \
29+
exit 1; \
30+
fi

.just/run.just

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Run 'n' nodes (default: 1). Usage: just run-n 3
2+
[group('run')]
3+
run-n nodes="1": build build-da
4+
@go run -tags=run scripts/run.go --nodes={{ nodes }}
5+
6+
# Run EVM nodes (one sequencer and one full node)
7+
[group('run')]
8+
run-evm-nodes nodes="1": build-da build-evm
9+
@echo "Starting EVM nodes..."
10+
@go run -tags=run_evm scripts/run-evm-nodes.go --nodes={{ nodes }}

.just/test.just

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Clear test cache
2+
[group('test')]
3+
clean-testcache:
4+
@echo "--> Clearing testcache"
5+
@go clean --testcache
6+
7+
# Run unit tests for all go.mods
8+
[group('test')]
9+
test:
10+
@echo "--> Running unit tests"
11+
@go run -tags='run integration' scripts/test.go
12+
13+
# Run all tests including Docker E2E
14+
[group('test')]
15+
test-all: test test-docker-e2e
16+
@echo "--> All tests completed"
17+
18+
# Run integration tests
19+
[group('test')]
20+
test-integration:
21+
@echo "--> Running integration tests"
22+
@cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' ./...
23+
24+
# Run e2e tests
25+
[group('test')]
26+
test-e2e: build build-da build-evm docker-build-if-local
27+
@echo "--> Running e2e tests"
28+
@cd test/e2e && go test -mod=readonly -failfast -timeout=15m -tags='e2e evm' ./... --binary=../../build/testapp --evm-binary=../../build/evm
29+
30+
# Run integration tests with coverage
31+
[group('test')]
32+
test-integration-cover:
33+
@echo "--> Running integration tests with coverage"
34+
@cd node && go test -mod=readonly -failfast -timeout=15m -tags='integration' -coverprofile=coverage.txt -covermode=atomic ./...
35+
36+
# Generate code coverage report
37+
[group('test')]
38+
test-cover:
39+
@echo "--> Running unit tests"
40+
@go run -tags=cover -race scripts/test_cover.go
41+
42+
# Run micro-benchmarks for internal cache
43+
[group('test')]
44+
bench:
45+
@echo "--> Running internal cache benchmarks"
46+
@go test -bench=. -benchmem -run='^$' ./block/internal/cache
47+
48+
# Run EVM tests
49+
[group('test')]
50+
test-evm:
51+
@echo "--> Running EVM tests"
52+
@cd execution/evm/test && go test -mod=readonly -failfast -timeout=15m ./... -tags=evm
53+
54+
# Run Docker E2E tests
55+
[group('test')]
56+
test-docker-e2e: docker-build-if-local
57+
@echo "--> Running Docker E2E tests"
58+
@echo "--> Verifying Docker image exists locally..."
59+
@if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "ev-node" ]; then \
60+
echo "--> Verifying Docker image exists locally..."; \
61+
docker image inspect evstack:local-dev >/dev/null 2>&1 || (echo "ERROR: evstack:local-dev image not found. Run 'just docker-build' first." && exit 1); \
62+
fi
63+
@cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e' -timeout=30m ./...
64+
@just docker-cleanup-if-local
65+
66+
# Run Docker E2E Upgrade tests
67+
[group('test')]
68+
test-docker-upgrade-e2e:
69+
@echo "--> Running Docker Upgrade E2E tests"
70+
@cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMSingleUpgradeSuite$$/^TestEVMSingleUpgrade$$' ./...
71+
72+
# Run Docker E2E cross-version compatibility tests
73+
[group('test')]
74+
test-docker-compat:
75+
@echo "--> Running Docker Sync Compatibility E2E tests"
76+
@cd test/docker-e2e && go test -mod=readonly -failfast -v -tags='docker_e2e evm' -timeout=30m -run '^TestEVMCompatSuite$$/^TestCrossVersionSync$$' ./...
77+
78+
# Build Docker image if using local repository
79+
[group('test')]
80+
docker-build-if-local:
81+
@if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "evstack" ]; then \
82+
if docker image inspect evstack:local-dev >/dev/null 2>&1; then \
83+
echo "--> Found local Docker image: evstack:local-dev (skipping build)"; \
84+
else \
85+
echo "--> Local repository detected, building Docker image..."; \
86+
just docker-build; \
87+
fi; \
88+
else \
89+
echo "--> Using remote repository: ${EV_NODE_IMAGE_REPO}"; \
90+
fi
91+
92+
# Clean up local Docker image if using local repository
93+
[group('test')]
94+
docker-cleanup-if-local:
95+
@if [ -z "${EV_NODE_IMAGE_REPO:-}" ] || [ "${EV_NODE_IMAGE_REPO:-}" = "evstack" ]; then \
96+
echo "--> Untagging local Docker image (preserving layers for faster rebuilds)..."; \
97+
docker rmi evstack:local-dev --no-prune 2>/dev/null || echo "Image evstack:local-dev not found or already removed"; \
98+
else \
99+
echo "--> Using remote repository, no cleanup needed"; \
100+
fi

.just/tools.just

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Build da-debug tool
2+
[group('tools')]
3+
build-tool-da-debug:
4+
@echo "--> Building da-debug tool"
5+
@mkdir -p {{ build_dir }}
6+
@cd tools/da-debug && go build -ldflags "{{ tool_ldflags }}" -o {{ build_dir }}/da-debug .
7+
@echo "--> da-debug built: {{ build_dir }}/da-debug"
8+
9+
# Build blob-decoder tool
10+
[group('tools')]
11+
build-tool-blob-decoder:
12+
@echo "--> Building blob-decoder tool"
13+
@mkdir -p {{ build_dir }}
14+
@cd tools/blob-decoder && go build -ldflags "{{ tool_ldflags }}" -o {{ build_dir }}/blob-decoder .
15+
@echo "--> blob-decoder built: {{ build_dir }}/blob-decoder"
16+
17+
# Build cache-analyzer tool
18+
[group('tools')]
19+
build-tool-cache-analyzer:
20+
@echo "--> Building cache-analyzer tool"
21+
@mkdir -p {{ build_dir }}
22+
@cd tools/cache-analyzer && go build -ldflags "{{ tool_ldflags }}" -o {{ build_dir }}/cache-analyzer .
23+
@echo "--> cache-analyzer built: {{ build_dir }}/cache-analyzer"
24+
25+
# Build all tools
26+
[group('tools')]
27+
build-tools: build-tool-da-debug build-tool-blob-decoder build-tool-cache-analyzer
28+
@echo "--> All tools built successfully!"
29+
30+
# Install da-debug tool to Go bin
31+
[group('tools')]
32+
install-tool-da-debug:
33+
@echo "--> Installing da-debug tool"
34+
@cd tools/da-debug && go install -ldflags "{{ tool_ldflags }}" .
35+
@echo "--> da-debug installed to Go bin"
36+
37+
# Install blob-decoder tool to Go bin
38+
[group('tools')]
39+
install-tool-blob-decoder:
40+
@echo "--> Installing blob-decoder tool"
41+
@cd tools/blob-decoder && go install -ldflags "{{ tool_ldflags }}" .
42+
@echo "--> blob-decoder installed to Go bin"
43+
44+
# Install cache-analyzer tool to Go bin
45+
[group('tools')]
46+
install-tool-cache-analyzer:
47+
@echo "--> Installing cache-analyzer tool"
48+
@cd tools/cache-analyzer && go install -ldflags "{{ tool_ldflags }}" .
49+
@echo "--> cache-analyzer installed to Go bin"
50+
51+
# Install all tools to Go bin
52+
[group('tools')]
53+
install-tools: install-tool-da-debug install-tool-blob-decoder install-tool-cache-analyzer
54+
@echo "--> All tools installed successfully!"
55+
56+
# Remove built tool binaries
57+
[group('tools')]
58+
clean-tools:
59+
@echo "--> Cleaning built tools"
60+
@rm -f {{ build_dir }}/da-debug {{ build_dir }}/blob-decoder {{ build_dir }}/cache-analyzer
61+
@echo "--> Tools cleaned"
62+
63+
# List available tools
64+
[group('tools')]
65+
list-tools:
66+
@echo "Available tools:"
67+
@echo " - da-debug"
68+
@echo " - blob-decoder"
69+
@echo " - cache-analyzer"

0 commit comments

Comments
 (0)