Merge branch 'main' into #205 #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: [push, pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: 1.85.0 | |
| targets: wasm32v1-none | |
| components: clippy, rustfmt | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Audit dependencies (RUSTSEC) | |
| run: cargo install cargo-audit@0.22.1 --locked && cargo audit | |
| - name: Check formatting | |
| run: cargo fmt --all --check | |
| - name: Clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Build | |
| run: cargo build --workspace | |
| - name: Build wasm (release) | |
| run: cargo build --workspace --release --target wasm32v1-none | |
| - name: Test | |
| run: cargo test --workspace | |
| - name: Check wasm size budget | |
| run: | | |
| echo "=== WASM Size Report ===" | |
| ls -lh target/wasm32v1-none/release/*.wasm 2>/dev/null || true | |
| echo "" | |
| echo "Checking against budget..." | |
| REGISTRY=$(stat -c%s target/wasm32v1-none/release/trusttrove_registry.wasm 2>/dev/null || echo 0) | |
| INVOICE=$(stat -c%s target/wasm32v1-none/release/trusttrove_invoice.wasm 2>/dev/null || echo 0) | |
| ESCROW=$(stat -c%s target/wasm32v1-none/release/trusttrove_escrow.wasm 2>/dev/null || echo 0) | |
| POOL=$(stat -c%s target/wasm32v1-none/release/trusttrove_pool.wasm 2>/dev/null || echo 0) | |
| # Budget in bytes (adjust as needed; Soroban charges by size) | |
| REGISTRY_BUDGET=1048576 # 1 MB | |
| INVOICE_BUDGET=2097152 # 2 MB | |
| ESCROW_BUDGET=1048576 # 1 MB | |
| POOL_BUDGET=2097152 # 2 MB | |
| echo "registry: $REGISTRY bytes (budget: $REGISTRY_BUDGET)" | |
| echo "invoice: $INVOICE bytes (budget: $INVOICE_BUDGET)" | |
| echo "escrow: $ESCROW bytes (budget: $ESCROW_BUDGET)" | |
| echo "pool: $POOL bytes (budget: $POOL_BUDGET)" | |
| [ "$REGISTRY" -le "$REGISTRY_BUDGET" ] || exit 1 | |
| [ "$INVOICE" -le "$INVOICE_BUDGET" ] || exit 1 | |
| [ "$ESCROW" -le "$ESCROW_BUDGET" ] || exit 1 | |
| [ "$POOL" -le "$POOL_BUDGET" ] || exit 1 |