Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 28 additions & 95 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
jobs:
build:
name: Build and Test
runs-on: macos-latest
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
Expand All @@ -31,60 +31,15 @@ jobs:
components: rustfmt, clippy

- name: Cache Cargo dependencies
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
workspaces: |
.
cache-directories: |
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install Soroban CLI
run: |
if ! command -v soroban &> /dev/null; then
echo "Attempting to install via Homebrew..."
if brew list stellar-cli &>/dev/null || brew install stellar-cli 2>/dev/null; then
echo "Installed via Homebrew"
else
echo "Homebrew install failed, installing via cargo..."
cargo install --locked --version 21.0.0 soroban-cli
fi
fi
# Try both commands in case Homebrew installs it as 'stellar'
if command -v soroban &> /dev/null; then
soroban --version
elif command -v stellar &> /dev/null; then
stellar --version
# Create alias for consistency
ln -s $(which stellar) /usr/local/bin/soroban || true
else
echo "Error: Neither soroban nor stellar CLI found"
exit 1
fi

- name: Verify Rust installation
run: |
rustc --version
cargo --version
rustup target list --installed | grep wasm32-unknown-unknown || rustup target add wasm32-unknown-unknown

- name: Build workspace (WASM)
run: |
cargo build --release --target wasm32-unknown-unknown --verbose
continue-on-error: false

- name: Build Soroban contracts
run: |
for contract in remittance_split savings_goals bill_payments insurance; do
echo "Building contract: $contract"
# Build from workspace root to ensure WASM files go to target/wasm32-unknown-unknown/release/
cargo build --release --target wasm32-unknown-unknown --package $contract --verbose
done
continue-on-error: false
run: cargo build --release --target wasm32-unknown-unknown --verbose

- name: Verify WASM files exist
run: |
Expand All @@ -97,25 +52,18 @@ jobs:
echo "✓ Found: $wasm_file ($(du -h $wasm_file | cut -f1))"
done

- name: Run Cargo tests
run: |
cargo test --verbose --all-features
continue-on-error: false
- name: Compile Tests (Workspace)
run: cargo test --workspace --all-features --exclude integration_tests --no-run

- name: Run Integration tests
run: |
cargo test -p integration_tests --verbose
continue-on-error: false
- name: Compile Integration Tests
run: cargo test -p integration_tests --no-run
continue-on-error: true

- name: Run Clippy
run: |
cargo clippy --all-targets --all-features -- -D warnings
continue-on-error: false
run: cargo clippy --all-targets --all-features --workspace

- name: Check formatting
run: |
cargo fmt --all -- --check
continue-on-error: false
- name: Check Formatting
run: cargo fmt --all -- --check

- name: Upload WASM artifacts
uses: actions/upload-artifact@v4
Expand All @@ -138,7 +86,7 @@ jobs:

security:
name: Security Checks
runs-on: macos-latest
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
Expand All @@ -149,17 +97,12 @@ jobs:
uses: dtolnay/rust-toolchain@stable

- name: Cache Cargo dependencies
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
workspaces: |
.
cache-directories: |
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install cargo-audit
run: |
Expand All @@ -168,14 +111,13 @@ jobs:
fi

- name: Run cargo audit
run: |
cargo audit --deny warnings
run: cargo audit --deny warnings
continue-on-error: true

gas-benchmarks:
name: Gas Benchmarks
runs-on: macos-latest
timeout-minutes: 15
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
pull-requests: write
Expand All @@ -190,27 +132,18 @@ jobs:
targets: wasm32-unknown-unknown

- name: Cache Cargo dependencies
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
workspaces: |
.
cache-directories: |
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install jq
run: |
if ! command -v jq &> /dev/null; then
brew install jq
fi
run: sudo apt-get update && sudo apt-get install -y jq

- name: Run gas benchmarks
run: |
./scripts/run_gas_benchmarks.sh
run: ./scripts/run_gas_benchmarks.sh
continue-on-error: false

- name: Check for gas regressions
Expand Down
36 changes: 18 additions & 18 deletions benchmarks/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,72 +35,72 @@
"contract": "remittance_split",
"method": "distribute_usdc",
"scenario": "4_recipients_all_nonzero",
"cpu": 708193,
"mem": 100165,
"cpu": 721998,
"mem": 102322,
"description": "Distribute USDC to 4 recipients with non-zero amounts"
},
{
"contract": "remittance_split",
"method": "create_remittance_schedule",
"scenario": "single_recurring_schedule",
"cpu": 46579,
"mem": 6979,
"cpu": 81503,
"mem": 11995,
"description": "Create a single recurring remittance schedule"
},
{
"contract": "remittance_split",
"method": "create_remittance_schedule",
"scenario": "11th_schedule_with_existing",
"cpu": 372595,
"mem": 99899,
"cpu": 134335,
"mem": 26734,
"description": "Create schedule when 10 existing schedules are present"
},
{
"contract": "remittance_split",
"method": "modify_remittance_schedule",
"scenario": "single_schedule_modification",
"cpu": 84477,
"mem": 15636,
"cpu": 69662,
"mem": 10525,
"description": "Modify an existing remittance schedule"
},
{
"contract": "remittance_split",
"method": "cancel_remittance_schedule",
"scenario": "single_schedule_cancellation",
"cpu": 84459,
"mem": 15564,
"cpu": 69644,
"mem": 10453,
"description": "Cancel an existing remittance schedule"
},
{
"contract": "remittance_split",
"method": "get_remittance_schedules",
"scenario": "empty_schedules",
"cpu": 13847,
"mem": 1456,
"cpu": 19961,
"mem": 2267,
"description": "Query schedules when none exist for owner"
},
{
"contract": "remittance_split",
"method": "get_remittance_schedules",
"scenario": "5_schedules_with_isolation",
"cpu": 197774,
"mem": 38351,
"cpu": 138060,
"mem": 13954,
"description": "Query 5 schedules with data isolation validation"
},
{
"contract": "remittance_split",
"method": "get_remittance_schedule",
"scenario": "single_schedule_lookup",
"cpu": 42932,
"mem": 6847,
"cpu": 34806,
"mem": 3779,
"description": "Retrieve a single schedule by ID"
},
{
"contract": "remittance_split",
"method": "get_remittance_schedules",
"scenario": "50_schedules_worst_case",
"cpu": 1251484,
"mem": 250040,
"cpu": 1209496,
"mem": 119588,
"description": "Query schedules in worst-case scenario with 50 schedules"
}
]
Loading
Loading