.PHONY: help clean build test test-unit test-e2e lint lint-fix format check docs install generate
help:
@echo "Available targets:"
@echo " generate - Generate api.rs from openapi.yaml"
@echo " clean - Remove generated files and build artifacts"
@echo " build - Build the project"
@echo " test - Run all tests (unit + integration)"
@echo " test-unit - Run unit tests only"
@echo " test-e2e - Run end-to-end tests"
@echo " lint - Run clippy linter (all files)"
@echo " lint-fix - Fix linting issues (all files)"
@echo " format - Format code with rustfmt"
@echo " check - Run cargo check"
@echo " docs - Generate documentation"
@echo " install - Install the package locally"
clean:
@echo "Cleaning build artifacts..."
cargo clean
@echo "Clean complete!"
generate:
@echo "Generating api.rs from openapi.yaml..."
CDP_GENERATE=1 cargo build && cargo fmt --all
@echo "Code generation complete!"
build:
@echo "Building Rust SDK..."
cargo build && cargo fmt --all
@echo "Build complete!"
build-release:
@echo "Building Rust SDK in release mode..."
cargo build --release && cargo fmt --all
@echo "Release build complete!"
test:
@echo "Running all tests..."
cargo test
@echo "All tests complete!"
test-unit:
@echo "Running unit tests..."
cargo test --lib
@echo "Unit tests complete!"
test-e2e:
@echo "Running end-to-end tests with verbose logging..."
@echo "Make sure the following environment variables are set:"
@echo " CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET"
E2E_LOGGING=true cargo test --test e2e -- --nocapture
@echo "E2E tests complete!"
lint:
@echo "Running clippy linter..."
cargo clippy --all-targets --all-features -- -D warnings
@echo "Linting complete!"
lint-fix:
@echo "Fixing linting issues..."
cargo clippy --fix --allow-dirty --allow-staged --all-features
@echo "Lint fixes complete!"
format:
@echo "Formatting code..."
cargo fmt --all
@echo "Formatting complete!"
format-check:
@echo "Checking code formatting..."
cargo fmt --all -- --check
@echo "Format check complete!"
check:
@echo "Running cargo check..."
cargo check
@echo "Check complete!"
docs:
@echo "Generating documentation..."
cargo doc --no-deps --open
@echo "Documentation generated!"
install:
@echo "Installing package locally..."
cargo install --path .
@echo "Installation complete!"
verify: check test lint format-check
@echo "All verifications passed!"
prepare: format lint-fix test build
@echo "Preparation complete!"
check-openapi:
@make -C .. check-openapi || echo "NOTE: THERE IS A NEW OPENAPI FILE AVAILABLE. RUN 'make update-openapi' IN THE ROOT DIRECTORY TO UPDATE IT."