forked from astera-hq/Astera
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.67 KB
/
Copy pathcontracts.yml
File metadata and controls
60 lines (50 loc) · 1.67 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
name: Soroban Contracts CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build-and-test:
name: Build & test Soroban contracts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust (stable) with wasm32 target
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
# Cache ~/.cargo/registry + Cargo build artifacts for faster runs.
# Swatinem/rust-cache is the community standard — it keys on the
# workflow + lockfile and handles registry, git deps, and target/.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
contracts
- name: Build WASM (workspace, release)
run: cargo build --target wasm32-unknown-unknown --release
- name: Run contract tests (invoice)
working-directory: contracts/invoice
run: cargo test --verbose
- name: Run contract tests (pool)
working-directory: contracts/pool
run: cargo test --verbose
- name: Run contract tests (credit_score)
working-directory: contracts/credit_score
run: cargo test --verbose
- name: Verify WASM sizes
run: |
for f in target/wasm32-unknown-unknown/release/*.wasm; do
size=$(du -k "$f" | cut -f1)
if [ "$size" -gt 200 ]; then
echo "Error: $f is too large ($size KB). Maximum allowed size is 200 KB."
exit 1
fi
echo "$f size: ${size} KB (OK)"
done