Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (97 loc) · 3.21 KB
/
Copy pathMakefile
File metadata and controls
116 lines (97 loc) · 3.21 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
# Makefile for Coinbase CDP Rust SDK
.PHONY: help clean build test test-unit test-e2e lint lint-fix format check docs install generate
# Default target
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 generated files and build artifacts
clean:
@echo "Cleaning build artifacts..."
cargo clean
@echo "Clean complete!"
# Generate api.rs from openapi.yaml
generate:
@echo "Generating api.rs from openapi.yaml..."
CDP_GENERATE=1 cargo build && cargo fmt --all
@echo "Code generation complete!"
# Build the project
build:
@echo "Building Rust SDK..."
cargo build && cargo fmt --all
@echo "Build complete!"
# Build in release mode
build-release:
@echo "Building Rust SDK in release mode..."
cargo build --release && cargo fmt --all
@echo "Release build complete!"
# Run all tests (unit + integration)
test:
@echo "Running all tests..."
cargo test
@echo "All tests complete!"
# Run unit tests only
test-unit:
@echo "Running unit tests..."
cargo test --lib
@echo "Unit tests complete!"
# Run end-to-end tests
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!"
# Run clippy linter
lint:
@echo "Running clippy linter..."
cargo clippy --all-targets --all-features -- -D warnings
@echo "Linting complete!"
# Fix linting issues
lint-fix:
@echo "Fixing linting issues..."
cargo clippy --fix --allow-dirty --allow-staged --all-features
@echo "Lint fixes complete!"
# Format code
format:
@echo "Formatting code..."
cargo fmt --all
@echo "Formatting complete!"
# Check code formatting
format-check:
@echo "Checking code formatting..."
cargo fmt --all -- --check
@echo "Format check complete!"
# Run cargo check
check:
@echo "Running cargo check..."
cargo check
@echo "Check complete!"
# Generate documentation
docs:
@echo "Generating documentation..."
cargo doc --no-deps --open
@echo "Documentation generated!"
# Install package locally
install:
@echo "Installing package locally..."
cargo install --path .
@echo "Installation complete!"
# Run all checks (check, test, lint, format-check)
verify: check test lint format-check
@echo "All verifications passed!"
# Prepare for release (format, lint-fix, test, build)
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."