forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci-contracts.sh
More file actions
65 lines (56 loc) · 1.56 KB
/
Copy pathci-contracts.sh
File metadata and controls
65 lines (56 loc) · 1.56 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
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONTRACTS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
# Supported contracts: all crates that compile cleanly under the pinned Soroban toolchain.
#
# Excluded (broken):
# - split-escrow: many compilation errors (draft/broken source)
# - multi-sig-splits: E0507 move error (needs ownership fix)
SUPPORTED_CONTRACTS=(
"achievement-badges"
"dispute-resolution"
"flash-loan"
"path-payment"
"split-template"
"staking"
)
COMMAND="${1:-all}"
run_for_contract() {
local contract="$1"
local manifest="$CONTRACTS_DIR/$contract/Cargo.toml"
echo ""
echo "==> $COMMAND :: $contract"
case "$COMMAND" in
fmt)
cargo fmt --manifest-path "$manifest" --all -- --check
;;
test)
cargo test --manifest-path "$manifest"
;;
build)
cargo build --manifest-path "$manifest" --target wasm32-unknown-unknown --release
;;
*)
echo "Unsupported command: $COMMAND (expected fmt, test, build, or all)"
echo "Usage: bash ./scripts/ci-contracts.sh [fmt|test|build|all]"
exit 1
;;
esac
}
if [ "$COMMAND" = "all" ]; then
# Run fmt, test, and build sequentially for all supported contracts
for step in fmt test build; do
COMMAND="$step"
for contract in "${SUPPORTED_CONTRACTS[@]}"; do
run_for_contract "$contract"
done
done
COMMAND="all"
else
for contract in "${SUPPORTED_CONTRACTS[@]}"; do
run_for_contract "$contract"
done
fi
echo ""
echo "All contract checks completed for: ${SUPPORTED_CONTRACTS[*]}"