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
51 lines (42 loc) · 1.38 KB
/
Copy pathci-contracts.sh
File metadata and controls
51 lines (42 loc) · 1.38 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
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONTRACTS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
# `split-escrow` is intentionally excluded for now because the Rust source in
# `contracts/split-escrow/src/lib.rs` is draft/broken and does not parse.
# `dispute-resolution` is also excluded because the contract/test API is still
# mid-port and does not compile under the pinned Soroban toolchain yet.
# `multi-sig-splits`, `path-payment`, `split-template`, and `staking` are
# excluded until they are verified clean under the pinned Soroban toolchain.
SUPPORTED_CONTRACTS=(
"achievement-badges"
"flash-loan"
)
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"
echo "Usage: bash ./scripts/ci-contracts.sh [fmt|test|build]"
exit 1
;;
esac
}
for contract in "${SUPPORTED_CONTRACTS[@]}"; do
run_for_contract "$contract"
done
echo ""
echo "All contract checks completed for: ${SUPPORTED_CONTRACTS[*]}"