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
#!/usr/bin/env bash
# NeoRust CI Check Script
# Run this before pushing to ensure CI will pass
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo -e "${BLUE}NeoRust CI Checks${NC}"
echo "=================="
echo ""
# Verify we're in the right place
if [ ! -f "Cargo.toml" ]; then
echo -e "${RED}Error: Not in NeoRust root directory${NC}"
exit 1
fi
# Check for required tools
missing_tools=()
for tool in cargo rustfmt; do
if ! command -v $tool &> /dev/null; then
missing_tools+=($tool)
fi
done
if [ ${#missing_tools[@]} -ne 0 ]; then
echo -e "${RED}Missing required tools: ${missing_tools[*]}${NC}"
echo "Please install Rust toolchain"
exit 1
fi
# Run checks
echo -e "${YELLOW}1. Format Check${NC}"
if cargo fmt --all -- --check; then
echo -e "${GREEN}✓ Format check passed${NC}"
else
echo -e "${RED}✗ Format check failed${NC}"
echo " Run: cargo fmt --all"
exit 1
fi
echo ""
echo -e "${YELLOW}2. Clippy Linting${NC}"
if cargo clippy --workspace --all-targets --all-features -- -D warnings; then
echo -e "${GREEN}✓ Clippy passed${NC}"
else
echo -e "${RED}✗ Clippy failed${NC}"
exit 1
fi
echo ""
echo -e "${YELLOW}3. Tests${NC}"
if NEORUST_SKIP_NETWORK_TESTS=1 cargo test -p neo3 --all-features; then
echo -e "${GREEN}✓ neo3 tests passed${NC}"
else
echo -e "${RED}✗ neo3 tests failed${NC}"
exit 1
fi
echo ""
if cargo test -p neo3 --doc --all-features; then
echo -e "${GREEN}✓ neo3 doc tests passed${NC}"
else
echo -e "${RED}✗ neo3 doc tests failed${NC}"
exit 1
fi
echo ""
if cargo test -p neo-cli; then
echo -e "${GREEN}✓ neo-cli tests passed${NC}"
else
echo -e "${RED}✗ neo-cli tests failed${NC}"
exit 1
fi
echo ""
echo -e "${GREEN}All CI checks passed! ✨${NC}"
echo "Safe to commit and push."