|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + RUST_BACKTRACE: 1 |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: Test |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Install Rust |
| 21 | + uses: dtolnay/rust-toolchain@stable |
| 22 | + with: |
| 23 | + components: rustfmt, clippy |
| 24 | + |
| 25 | + - name: Cache cargo registry |
| 26 | + uses: actions/cache@v4 |
| 27 | + with: |
| 28 | + path: | |
| 29 | + ~/.cargo/bin/ |
| 30 | + ~/.cargo/registry/index/ |
| 31 | + ~/.cargo/registry/cache/ |
| 32 | + ~/.cargo/git/db/ |
| 33 | + target/ |
| 34 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 35 | + restore-keys: | |
| 36 | + ${{ runner.os }}-cargo- |
| 37 | + |
| 38 | + - name: Run tests |
| 39 | + run: cargo test --workspace --all-features |
| 40 | + |
| 41 | + - name: Check formatting |
| 42 | + run: cargo fmt --all -- --check |
| 43 | + |
| 44 | + - name: Run clippy |
| 45 | + run: cargo clippy --workspace --all-features -- -D warnings |
| 46 | + |
| 47 | + build: |
| 48 | + name: Build |
| 49 | + runs-on: ubuntu-latest |
| 50 | + needs: test |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Install Rust |
| 55 | + uses: dtolnay/rust-toolchain@stable |
| 56 | + |
| 57 | + - name: Cache cargo registry |
| 58 | + uses: actions/cache@v4 |
| 59 | + with: |
| 60 | + path: | |
| 61 | + ~/.cargo/bin/ |
| 62 | + ~/.cargo/registry/index/ |
| 63 | + ~/.cargo/registry/cache/ |
| 64 | + ~/.cargo/git/db/ |
| 65 | + target/ |
| 66 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 67 | + restore-keys: | |
| 68 | + ${{ runner.os }}-cargo- |
| 69 | + |
| 70 | + - name: Build contracts |
| 71 | + run: cargo build --workspace --release |
| 72 | + |
| 73 | + - name: Check contract builds |
| 74 | + run: | |
| 75 | + for contract in contracts/*/; do |
| 76 | + if [ -f "$contract/Cargo.toml" ]; then |
| 77 | + echo "Building contract: $contract" |
| 78 | + cargo build --manifest-path "$contract/Cargo.toml" --release |
| 79 | + fi |
| 80 | + done |
| 81 | +
|
0 commit comments