|
| 1 | +name: Soroban Contracts CI |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + paths: |
| 12 | + - 'quantara/soroban/contracts/**' |
| 13 | + - '.github/workflows/soroban.yml' |
| 14 | + pull_request: |
| 15 | + branches: |
| 16 | + - main |
| 17 | + paths: |
| 18 | + - 'quantara/soroban/contracts/**' |
| 19 | + - '.github/workflows/soroban.yml' |
| 20 | + |
| 21 | +env: |
| 22 | + CARGO_TERM_COLOR: always |
| 23 | + # 1.88.0 is required by transitive soroban-sdk deps: |
| 24 | + # - edition2024 Cargo feature (stable since 1.85.0) |
| 25 | + # - darling 0.23.0 and serde_with 3.21.0 require rustc >= 1.88.0 |
| 26 | + RUST_TOOLCHAIN: "1.88.0" |
| 27 | + |
| 28 | +defaults: |
| 29 | + run: |
| 30 | + working-directory: quantara/soroban/contracts |
| 31 | + |
| 32 | +jobs: |
| 33 | + # ── 1. Formatting ─────────────────────────────────────────────────────────── |
| 34 | + fmt: |
| 35 | + name: Formatting (cargo fmt --check) |
| 36 | + runs-on: ubuntu-latest |
| 37 | + permissions: |
| 38 | + contents: read |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v7 |
| 43 | + |
| 44 | + - name: Install Rust toolchain |
| 45 | + uses: dtolnay/rust-toolchain@stable |
| 46 | + with: |
| 47 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 48 | + targets: wasm32-unknown-unknown |
| 49 | + components: rustfmt |
| 50 | + |
| 51 | + - name: Cache Cargo registry & build artifacts |
| 52 | + uses: actions/cache@v4 |
| 53 | + with: |
| 54 | + path: | |
| 55 | + ~/.cargo/registry/index/ |
| 56 | + ~/.cargo/registry/cache/ |
| 57 | + ~/.cargo/git/db/ |
| 58 | + quantara/soroban/contracts/target/ |
| 59 | + key: ${{ runner.os }}-cargo-fmt-${{ hashFiles('quantara/soroban/contracts/Cargo.toml', 'quantara/soroban/contracts/**/Cargo.toml') }} |
| 60 | + restore-keys: | |
| 61 | + ${{ runner.os }}-cargo-fmt- |
| 62 | +
|
| 63 | + - name: Check formatting |
| 64 | + run: cargo fmt --all -- --check |
| 65 | + |
| 66 | + # ── 2. Lint ───────────────────────────────────────────────────────────────── |
| 67 | + clippy: |
| 68 | + name: Lint (cargo clippy -- -D warnings) |
| 69 | + runs-on: ubuntu-latest |
| 70 | + permissions: |
| 71 | + contents: read |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Checkout repository |
| 75 | + uses: actions/checkout@v7 |
| 76 | + |
| 77 | + - name: Install Rust toolchain |
| 78 | + uses: dtolnay/rust-toolchain@stable |
| 79 | + with: |
| 80 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 81 | + targets: wasm32-unknown-unknown |
| 82 | + components: clippy |
| 83 | + |
| 84 | + - name: Cache Cargo registry & build artifacts |
| 85 | + uses: actions/cache@v4 |
| 86 | + with: |
| 87 | + path: | |
| 88 | + ~/.cargo/registry/index/ |
| 89 | + ~/.cargo/registry/cache/ |
| 90 | + ~/.cargo/git/db/ |
| 91 | + quantara/soroban/contracts/target/ |
| 92 | + key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('quantara/soroban/contracts/Cargo.toml', 'quantara/soroban/contracts/**/Cargo.toml') }} |
| 93 | + restore-keys: | |
| 94 | + ${{ runner.os }}-cargo-clippy- |
| 95 | +
|
| 96 | + - name: Run Clippy (deny all warnings) |
| 97 | + run: cargo clippy --all-targets --all-features -- -D warnings |
| 98 | + |
| 99 | + # ── 3. Dependency audit ────────────────────────────────────────────────────── |
| 100 | + deny: |
| 101 | + name: Dependency audit (cargo deny check) |
| 102 | + runs-on: ubuntu-latest |
| 103 | + permissions: |
| 104 | + contents: read |
| 105 | + |
| 106 | + steps: |
| 107 | + - name: Checkout repository |
| 108 | + uses: actions/checkout@v7 |
| 109 | + |
| 110 | + - name: Run cargo deny |
| 111 | + uses: EmbarkStudios/cargo-deny-action@v2 |
| 112 | + with: |
| 113 | + rust-version: ${{ env.RUST_TOOLCHAIN }} |
| 114 | + command: check |
| 115 | + manifest-path: quantara/soroban/contracts/Cargo.toml |
| 116 | + arguments: --config quantara/soroban/contracts/deny.toml |
| 117 | + |
| 118 | + # ── 4. Build ──────────────────────────────────────────────────────────────── |
| 119 | + build: |
| 120 | + name: Build (wasm32-unknown-unknown) |
| 121 | + runs-on: ubuntu-latest |
| 122 | + permissions: |
| 123 | + contents: read |
| 124 | + needs: [fmt, clippy, deny] |
| 125 | + |
| 126 | + steps: |
| 127 | + - name: Checkout repository |
| 128 | + uses: actions/checkout@v7 |
| 129 | + |
| 130 | + - name: Install Rust toolchain |
| 131 | + uses: dtolnay/rust-toolchain@stable |
| 132 | + with: |
| 133 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 134 | + targets: wasm32-unknown-unknown |
| 135 | + |
| 136 | + - name: Cache Cargo registry & build artifacts |
| 137 | + uses: actions/cache@v4 |
| 138 | + with: |
| 139 | + path: | |
| 140 | + ~/.cargo/registry/index/ |
| 141 | + ~/.cargo/registry/cache/ |
| 142 | + ~/.cargo/git/db/ |
| 143 | + quantara/soroban/contracts/target/ |
| 144 | + key: ${{ runner.os }}-cargo-build-${{ hashFiles('quantara/soroban/contracts/Cargo.toml', 'quantara/soroban/contracts/**/Cargo.toml') }} |
| 145 | + restore-keys: | |
| 146 | + ${{ runner.os }}-cargo-build- |
| 147 | +
|
| 148 | + - name: Build contracts |
| 149 | + run: cargo build --target wasm32-unknown-unknown --release |
0 commit comments