-
Notifications
You must be signed in to change notification settings - Fork 80
84 lines (69 loc) · 2.06 KB
/
Copy pathtest.yml
File metadata and controls
84 lines (69 loc) · 2.06 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
name: CI
on:
push:
branches: [main, "feat/**"]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build-and-test:
name: Build & Test (Soroban)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-${{ hashFiles('contracts/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Run tests
working-directory: contracts
run: cargo test --quiet
- name: Build WASM targets
working-directory: contracts
run: cargo build --target wasm32v1-none --release --quiet
- name: Run Clippy
working-directory: contracts
run: cargo clippy --all-targets -- -D warnings
wasm-size:
name: WASM Binary Size Report
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-${{ hashFiles('contracts/Cargo.lock') }}
- name: Build WASM
working-directory: contracts
run: cargo build --target wasm32v1-none --release --quiet
- name: Report binary sizes
working-directory: contracts
run: |
echo "| Contract | Size (KB) |"
echo "|----------|-----------|"
for f in target/wasm32v1-none/release/*.wasm; do
name=$(basename "$f" .wasm)
size=$(du -k "$f" | cut -f1)
echo "| $name | ${size} |"
done