Skip to content

Commit 53d8ca4

Browse files
committed
Ensure validate.sh works locally (MacOS)
1 parent 8ecef5a commit 53d8ca4

File tree

4 files changed

+77
-5
lines changed

4 files changed

+77
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ website/static/api-docs/
1919
ledger/3.0.0mainnet
2020
ledger/berkeley-devnet
2121
mina-workdir
22+
.idea/

Makefile

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fix-trailing-whitespace: ## Remove trailing whitespaces from all files
177177
-not -path "./website/static/api-docs/*" \
178178
-not -path "./website/.docusaurus/*" \
179179
-not -path "./.git/*" \
180-
-exec sh -c 'echo "Processing: $$1"; sed -i"" -e "s/[[:space:]]*$$//" "$$1"' _ {} \; && \
180+
-exec sh -c 'echo "Processing: $$1"; sed -i"" "s/[[:space:]]*$$//" "$$1"' _ {} \; && \
181181
echo "Trailing whitespaces removed."
182182

183183
.PHONY: check-trailing-whitespace
@@ -287,6 +287,42 @@ setup-wasm: ## Setup the WebAssembly toolchain, using nightly
287287
rustup target add wasm32-unknown-unknown --toolchain ${NIGHTLY_RUST_VERSION}-$$TARGET; \
288288
cargo install wasm-bindgen-cli --version ${WASM_BINDGEN_CLI_VERSION}
289289

290+
.PHONY: setup-taplo
291+
setup-taplo: ## Install taplo TOML formatter if not present
292+
@if ! command -v taplo &> /dev/null; then \
293+
echo "Installing taplo..."; \
294+
if command -v cargo-binstall &> /dev/null; then \
295+
cargo binstall -y taplo-cli; \
296+
else \
297+
TAPLO_VERSION="0.9.3"; \
298+
OS=$$(uname -s | tr '[:upper:]' '[:lower:]'); \
299+
ARCH=$$(uname -m); \
300+
case "$$OS" in \
301+
darwin) OS="darwin" ;; \
302+
linux) OS="linux" ;; \
303+
*) echo "Unsupported OS: $$OS"; exit 1 ;; \
304+
esac; \
305+
case "$$ARCH" in \
306+
x86_64) ARCH="x86_64" ;; \
307+
arm64|aarch64) ARCH="aarch64" ;; \
308+
*) echo "Unsupported architecture: $$ARCH"; exit 1 ;; \
309+
esac; \
310+
TAPLO_URL="https://github.com/tamasfe/taplo/releases/download/$${TAPLO_VERSION}/taplo-full-$${OS}-$${ARCH}.gz"; \
311+
echo "Downloading taplo from $${TAPLO_URL}..."; \
312+
curl -L "$${TAPLO_URL}" | gunzip > /tmp/taplo; \
313+
chmod +x /tmp/taplo; \
314+
if [ -d "$$HOME/.cargo/bin" ]; then \
315+
mv /tmp/taplo "$$HOME/.cargo/bin/taplo"; \
316+
echo "Installed taplo to ~/.cargo/bin/taplo"; \
317+
else \
318+
echo "Warning: ~/.cargo/bin not found, taplo installed to /tmp/taplo"; \
319+
echo "Please add ~/.cargo/bin to PATH or move /tmp/taplo manually"; \
320+
fi; \
321+
fi; \
322+
else \
323+
echo "taplo is already installed"; \
324+
fi
325+
290326
.PHONY: test
291327
test: ## Run tests
292328
cargo test
@@ -391,6 +427,11 @@ docker-build-heartbeats-processor: ## Build heartbeats processor Docker image
391427
docker build -t $(DOCKER_ORG)/mina-rust-heartbeats-processor:$(GIT_COMMIT) \
392428
tools/heartbeats-processor/
393429

430+
.PHONY: heartbeats-db-init
431+
heartbeats-db-init: ## Initialize the heartbeats database with schema
432+
@sqlite3 /tmp/heartbeats.db < tools/heartbeats-processor/schema.sql
433+
@echo "Database initialized at /tmp/heartbeats.db"
434+
394435
.PHONY: docker-build-light
395436
docker-build-light: ## Build light Docker image
396437
docker build -t $(DOCKER_ORG)/mina-rust-light:$(GIT_COMMIT) \

taplo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include = ["**/*.toml"]
2+
exclude = ["**/node_modules/**", "**/target/**", "**/.git/**"]
23

34
[formatting]
45
reorder_keys = false

website/docs/developers/scripts/release/validate.sh

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,40 @@ set -e
33

44
echo "Validating codebase for release..."
55

6-
echo "Running tests..."
7-
make test
6+
echo "Setting up required tools..."
7+
make setup-taplo
88

9-
echo "Running tests in release mode..."
10-
make test-release
9+
echo "Cleaning build artifacts to avoid version conflicts..."
10+
cargo clean
11+
12+
echo "Initializing heartbeats database..."
13+
make heartbeats-db-init
14+
15+
echo "Exporting DATABASE_URL for SQLx..."
16+
export DATABASE_URL="sqlite:///tmp/heartbeats.db"
17+
18+
echo "=== Testing stable Rust packages ==="
19+
20+
echo "Testing mina-node-native..."
21+
make test-node-native
22+
23+
echo "Testing p2p..."
24+
make test-p2p
25+
26+
echo "Testing account..."
27+
make test-account
28+
29+
echo "=== Cleaning for nightly Rust packages ==="
30+
cargo clean
31+
32+
echo "Testing ledger..."
33+
make test-ledger
34+
35+
echo "Testing mina-p2p-messages..."
36+
make test-p2p-messages
37+
38+
echo "Testing vrf..."
39+
make test-vrf
1140

1241
echo "Checking code formatting..."
1342
make check-format

0 commit comments

Comments
 (0)