Merge pull request #29 from ayomideadeniran/fix/issue-27-blend-calls #51
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: | |
| branches: ["main", "develop", "feat/**"] | |
| pull_request: | |
| branches: ["main", "develop"] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 3 * * 0" | |
| jobs: | |
| ci-matrix: | |
| name: CI Matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: "Format Check" | |
| step: "fmt" | |
| working_directory: "neurowealth-vault" | |
| - name: "Clippy Lint" | |
| step: "clippy" | |
| working_directory: "neurowealth-vault" | |
| - name: "Tests" | |
| step: "test" | |
| working_directory: "neurowealth-vault" | |
| - name: "Build WASM" | |
| step: "build-wasm" | |
| working_directory: "neurowealth-vault" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain with components | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| targets: wasm32-unknown-unknown | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: neurowealth-vault | |
| - name: Cache cargo registry and tooling | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ~/.local/bin/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install Stellar CLI | |
| if: matrix.step == 'build-wasm' | |
| run: | | |
| mkdir -p "$HOME/.local/bin" | |
| curl -sSL https://github.com/stellar/soroban-tools/releases/download/v21.2.0/soroban-cli-21.2.0-x86_64-unknown-linux-gnu.tar.gz | tar -xz | |
| mv soroban "$HOME/.local/bin/soroban" | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| soroban --version | |
| - name: Install wasm-opt | |
| if: matrix.step == 'build-wasm' | |
| run: cargo install wasm-opt --locked | |
| - name: Run ${{ matrix.name }} | |
| working-directory: ${{ matrix.working_directory }} | |
| shell: bash | |
| env: | |
| CARGO_TARGET_DIR: ${{ runner.temp }}/neurowealth-target | |
| run: | | |
| set -euo pipefail | |
| case "${{ matrix.step }}" in | |
| fmt) | |
| cargo fmt --all -- --check | |
| ;; | |
| clippy) | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| ;; | |
| test) | |
| cargo test --verbose | |
| ;; | |
| build-wasm) | |
| RUSTFLAGS="-C target-cpu=mvp" cargo build \ | |
| --target wasm32-unknown-unknown \ | |
| --release | |
| WASM_DIR="${CARGO_TARGET_DIR:-target}/wasm32-unknown-unknown/release" | |
| WASM_FILE="$WASM_DIR/neurowealth_vault.wasm" | |
| wasm-opt --strip-target-features --mvp-features \ | |
| "$WASM_FILE" \ | |
| -o "$WASM_FILE" | |
| ;; | |
| *) | |
| echo "Unknown step: ${{ matrix.step }}" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| e2e-devnet: | |
| name: E2E Devnet Validation | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: ci-matrix | |
| if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' | |
| env: | |
| SOROBAN_RPC_URL: https://soroban-testnet.stellar.org | |
| SOROBAN_NETWORK_PASSPHRASE: "Test SDF Network ; September 2015" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: neurowealth-vault | |
| - name: Install Stellar CLI | |
| run: | | |
| if [[ -x "$HOME/.local/bin/soroban" ]]; then | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| soroban --version | |
| exit 0 | |
| fi | |
| mkdir -p "$HOME/.local/bin" | |
| curl -sSL https://github.com/stellar/soroban-tools/releases/download/v21.2.0/soroban-cli-21.2.0-x86_64-unknown-linux-gnu.tar.gz | tar -xz | |
| mv soroban "$HOME/.local/bin/soroban" | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| soroban --version | |
| - name: Install wasm-opt | |
| run: cargo install wasm-opt --locked | |
| - name: Build contract WASM (MVP-compatible) | |
| working-directory: neurowealth-vault | |
| env: | |
| CARGO_TARGET_DIR: ${{ runner.temp }}/neurowealth-target | |
| run: | | |
| RUSTFLAGS="-C target-cpu=mvp" cargo build \ | |
| --target wasm32-unknown-unknown \ | |
| --release | |
| WASM_DIR="${CARGO_TARGET_DIR:-target}/wasm32-unknown-unknown/release" | |
| WASM_FILE="$WASM_DIR/neurowealth_vault.wasm" | |
| wasm-opt --strip-target-features --mvp-features \ | |
| "$WASM_FILE" \ | |
| -o "$WASM_FILE" | |
| - name: Make scripts executable | |
| run: chmod +x scripts/e2e-devnet.sh scripts/e2e-restore.sh | |
| - name: Run E2E devnet validation | |
| id: e2e | |
| run: | | |
| echo "::group::E2E Output" | |
| ./scripts/e2e-devnet.sh 2>&1 | tee scripts/e2e-artifacts/full_output.log | |
| echo "::endgroup::" | |
| - name: Upload E2E artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-devnet-artifacts | |
| path: scripts/e2e-artifacts/ | |
| retention-days: 14 | |
| - name: Cleanup testnet state | |
| if: always() | |
| run: ./scripts/e2e-restore.sh --keep-artifacts | |
| - name: Report failure details | |
| if: failure() | |
| run: | | |
| echo "## E2E Devnet Validation Failed" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ -f scripts/e2e-artifacts/summary.txt ]]; then | |
| echo "### Scenario Results" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat scripts/e2e-artifacts/summary.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ -f scripts/e2e-artifacts/contract_id.txt ]]; then | |
| CID=$(cat scripts/e2e-artifacts/contract_id.txt) | |
| echo "### References" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Contract ID:** \`$CID\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Explorer:** [View on StellarExpert](https://stellar.expert/explorer/testnet/contract/$CID)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Check the uploaded **e2e-devnet-artifacts** for full logs and transaction details." >> $GITHUB_STEP_SUMMARY | |
| - name: Report success details | |
| if: success() | |
| run: | | |
| echo "## E2E Devnet Validation Passed" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ -f scripts/e2e-artifacts/summary.txt ]]; then | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat scripts/e2e-artifacts/summary.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [[ -f scripts/e2e-artifacts/contract_id.txt ]]; then | |
| CID=$(cat scripts/e2e-artifacts/contract_id.txt) | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Contract ID:** \`$CID\`" >> $GITHUB_STEP_SUMMARY | |
| fi |