This document describes the automated testing pipeline implemented for the Utility Drip Contracts project.
The GitHub Actions workflow (.github/workflows/test.yml) automatically runs on:
- Push to main branch - Ensures main branch is always tested
- Pull Requests to main - Prevents breaking changes from being merged
- Rust Toolchain: Installs stable Rust with WASM target
- Stellar CLI: Installs Stellar CLI v25.1.0 for contract interaction
- Dependency Caching: Caches Cargo dependencies for faster builds
- Formatting:
cargo fmt --all -- --checkensures consistent code formatting - Linting:
cargo clippy --target wasm32-unknown-unknown -- -D warningscatches potential issues
- WASM Build:
cargo build --target wasm32-unknown-unknown --releasebuilds smart contract - Unit Tests:
cargo testruns all unit tests including fuzz tests - Fuzz Tests: Detects and validates fuzz testing infrastructure
The pipeline includes automatic detection of fuzz tests:
- Checks for
contracts/utility_contracts/fuzz/directory - Installs
cargo-fuzzif fuzz tests are present - Validates fuzz testing infrastructure availability
- Unit Tests: Standard contract functionality tests
- Fuzz Tests:
- Debt calculation underflow protection
- Extreme usage scenarios
- Balance handling edge cases
- Arithmetic overflow protection
- ✅ Workflow runs on push to main
- ✅
cargo testpasses successfully - ✅ Code formatting validated
- ✅ Clippy linting passes
- ✅ WASM build succeeds
- ✅ Fuzz tests infrastructure available
CARGO_TERM_COLOR: always- Ensures colored output in logs
- OS: Ubuntu Latest (ubuntu-latest)
- Target: wasm32-unknown-unknown (for Soroban contracts)
- Rust Version: Stable with required components
- Prevents Breaking Changes: Every PR is automatically tested
- Code Quality: Enforces formatting and linting standards
- Fast Feedback: Caching and parallel execution provide quick results
- Comprehensive Testing: Unit + fuzz testing coverage
- WASM Compatibility: Ensures contracts build for target platform
- No manual intervention required
- Tests run automatically on git events
- Results displayed in GitHub Actions UI
# Run same tests locally
cargo fmt --all -- --check
cargo clippy --target wasm32-unknown-unknown -- -D warnings
cargo build --target wasm32-unknown-unknown --release
cargo test
# Run fuzz tests (if available)
cd contracts/utility_contracts/fuzz
cargo fuzz run debt_calculation_fuzz -- -max_total_time 30The pipeline generates a summary in GitHub Actions including:
- ✅ Unit tests status
- ✅ Clippy linting status
- ✅ Code formatting status
- ✅ WASM build status
- ✅ Fuzz tests availability
This ensures every pull request maintains code quality and prevents regressions in smart contract logic.