push for this OD month #91
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: Soroban Smart Contracts CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| source $HOME/.cargo/env | |
| - name: Install Rust target for Soroban | |
| run: | | |
| source $HOME/.cargo/env | |
| rustup target add wasm32-unknown-unknown | |
| rustup target add wasm32v1-none | |
| - name: Install Stellar CLI with Homebrew | |
| run: | | |
| brew update | |
| brew install stellar-cli | |
| stellar --version | |
| - name: Cache cargo registry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Build Cargo project | |
| run: | | |
| source $HOME/.cargo/env | |
| cargo build --release --verbose | |
| - name: Run Cargo tests | |
| run: | | |
| source $HOME/.cargo/env | |
| cargo test --all --verbose | |
| - name: Build Soroban contracts | |
| run: | | |
| source $HOME/.cargo/env | |
| # Build individual contracts | |
| for contract in contracts/*/; do | |
| if [ -f "$contract/Cargo.toml" ]; then | |
| echo "Building optimized contract in $contract" | |
| cd "$contract" | |
| stellar contract build --verbose | |
| cd ../.. | |
| fi | |
| done | |
| # Build contracts in course subdirectory | |
| for contract in contracts/course/*/; do | |
| if [ -f "$contract/Cargo.toml" ]; then | |
| echo "Building optimized contract in $contract" | |
| cd "$contract" | |
| stellar contract build --verbose | |
| cd ../../.. | |
| fi | |
| done |